jquery text replace
$(".text_div").text(function () { return $(this).text().replace("contains", "hello everyone"); });
jquery find and replace text
$('#id1 p').each(function() { // get element text var text = $(this).text(); // modify text text = text.replace('dog', 'doll'); // update element text $(this).text(text); });
Source: stackoverflow.com