cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot find function replace

lordzoster
Champ in-the-making
Champ in-the-making
Hallo
I'm performing a replace on the content of a node, in this way:

var str = node.properties.content;
var result = str.replace("apple", "orange");
but I'm getting an Exception "org.mozilla.javascript.EcmaError - TypeError: Cannot find function replace"

Could anybody help me please?
Thanks in advance
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
For getting content you need to use this
var str- node.properties.content.content;

kaynezhang
World-Class Innovator
World-Class Innovator
Please use var str = node.properties.content.content; instead of var str = node.properties.content;

like following

var str = node.properties.content.content;
var result = str.replace("apple", "orange");


Sorry already answered by mitpatoliya ,I didn't see it