jquery - Find certain text on page and make it underlined -


how find text on web page , make underlined?

for example, have text on page , want find words hello , make them underlined.

my trial code is:

$( "body:contains('hello')" ).css( "text-decoration", "underline" ); 

but ends underlining whole line instead of word.

try this.

html

<p>for example, have text on page , want find words hello , make them bold.</p> 

script

$('p').html( $('p').html().replace(/hello/g, '<strong>hello</strong>') ) 

fiddle demo


Comments

Popular posts from this blog

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

node.js - Nodejs javascript implementation of PBEWithMD5AndTripleDES/CBC/PKCS5Padding -