jQuery:漂亮的符号

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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. });

以上是关于jQuery:漂亮的符号的主要内容,如果未能解决你的问题,请参考以下文章