Posted By

batfan on 06/16/11


Tagged


Versions (?)

Find/Modify Specific Text


 / Published in: jQuery
 

Find any instances of certain text in an element and modify it.

  1. $("#main-div").html(function(i,text){
  2. return text.replace("keyword", function(match){
  3. return '<span class="red">' + match + '</span>';
  4. });
  5. });

Report this snippet  

You need to login to post a comment.