[removed] find strings in dom and emphasize it

后端 未结 3 1011
野趣味
野趣味 2020-12-15 12:49

i want a function that finds some strings i\'ve got in an array in the DOM and emphasize it.

eg.

keywords[0] = \'linux\';
keywords[1] = \'suse pro\';         


        
3条回答
  •  一整个雨季
    2020-12-15 13:33

    This is probably the easiest way, but maybe not the best way: http://www.tizag.com/javascriptT/javascript-string-replace.php (scroll down to the bottom, where it says "Replace Function: Global Regular Expression"

    You would replace linux with linux, etc.

提交回复
热议问题