Wrap Each * on a Page Using jQuery

后端 未结 5 1294
挽巷
挽巷 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:42

    Without using jQuery so it might be a little faster, and definitely not dependent on libs:

    (function(str,e){
        var regex = new RegExp(str, 'gi');
        e.innerHTML = e.innerHTML.replace(regex, '*');
    })('*',document.body);
    

提交回复
热议问题