Posted By

dtigraphics on 12/29/10


jquery text modification ampersand fancy

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


jQuery: fancy ampersands

 / Published in: jQuery

This snippet will replace any "&" within the text of the container your specify with a that you can target with CSS; fancy!

  1. //Fancy Ampersands
  2. $('*:contains("&")','#id-of-your-page-container').each(function(){
  3. $(this).html($(this).html().replace(/&amp;/g,'<em class="ampersand">&amp;<\/em>'));
  4. });

Report this snippet  

You need to login to post a comment.