Return to Snippet

Revision: 38226
at December 29, 2010 02:23 by dtigraphics


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

Initial URL

                                

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

Initial Title
jQuery: fancy ampersands

Initial Tags
jquery, text

Initial Language
jQuery