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

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -