 <p><strong>HTML</strong></p> <pre><code>&lt;div id='mydiv'&gt;Lorem&lt;span&gt; ipsum&lt;/span&gt; dolor amet&lt;/div&gt; </code></pre> <p><strong>JS/Jquery</strong></p> <pre><code>var elm = $('#mydiv'); highlite(elm, 2, 28); //specify the start and end position // if you know the word you can find the index of word using indexOf/lastIndexOf function highlite(element, startpos, endpos) { var rgxp = elm.html().substr(startpos,endpos) var repl = '&lt;span class="myClass"&gt;' + rgxp + '&lt;/span&gt;'; elm.html(elm.html().replace(rgxp, repl)); } </code></pre> <p><strong>Demo</strong></p> <p><a href="http://jsfiddle.net/raunakkathuria/sD2pX/" rel="nofollow">http://jsfiddle.net/raunakkathuria/sD2pX/</a></p>