I want to find and replace text in a HTML document between, say inside the
var str = \"
You can also do something like this:
var doc = $($.parseXML(str)); doc.find('title').text(newTitle); // get your new data back to a string str = (new XMLSerializer()).serializeToString(doc[0]);
Here is a fiddle: http://jsfiddle.net/Z89dL/1/