jQuery: replace string in an element and add it to the DOM -


I want to change a string in an element, so give it a place again in the dom (but definitely new string with).

I have tried to:

  var foo = $ ('span'). ToString (); Var aux = foo.replace ('hello', 'hola'); After $ ('time') ($ parseHTML (aux).).  

But it does not work.

You need to get the text from the div, change the text, then replace it Here is an example

  var foo = $ ('div'); Var text = foo.text (); Var aux = text.replace ('hello', 'hola'); After $ ('div') (aux).  


Comments