Wrap Each * on a Page Using jQuery

后端 未结 5 1297
挽巷
挽巷 2021-01-06 06:55

I need to wrap each asterisks on a page with . The few things I\'ve tried don\'t work. I think what this boils down to is

5条回答
  •  不知归路
    2021-01-06 07:44

    How about this?...

    http://jsfiddle.net/n3Sqn/

     $("body:contains(*)").contents().each(function() {
      if(this.nodeType == 1)
      {
          $(this).html($(this).html().replace(/\*/g, "*"))
      }
    });
    

提交回复
热议问题