[Solved] Search Text and Replace with JavaScript


var ele = $("div.description");                     //Let ele be target element
ele.html(ele.html().replace(/smile/gi,"think"));    //Replace the word in string,
                                                    // then put it back in.

.replace: MDN

Demo: http://jsfiddle.net/DerekL/FdyEH/

0

solved Search Text and Replace with JavaScript