jQuery: fancy ampersands


/ Published in: jQuery
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.