Remove or replace a word in a text

Posted by Prabhukiran345 under jQuery category on | Points: 40 | Views : 582
Sometimes we come across a scenario to remove/Replace words in a text.The following code can be easily modified to replace a word by another.
var objElement = $(‘#id’); 

//Id of the control that contains target text

objElement.html(objElement.html().replace(/word/ig, “”));

// Here i simply replaced text with blank.You may replace it with the word you want

Comments or Responses

Login to post response