Posted By

vaughanj on 02/01/13


Tagged

word replacefindswap


Versions (?)

Find a string and replace it with another string


 / Published in: jQuery
 

Finds a matching string in a DOM element and replaces it with another string.

Originally used to change "[Entries] in CategoryA" to "[Projects] in CategoryA".

  1. $("#header h2").each(function(){
  2. $(this).text($(this).text().replace("swap this", "for this"));
  3. });

Report this snippet  

You need to login to post a comment.