Highlight similar text using jquery
<p>I have large text containers and i want to compare and highlight them using jquery. The question answered here <a href="http://stackoverflow.com/questions/119441/highlight-a-word-with-jquery">highlight a word with jquery</a> is perfect except it contains repetition of text. Here is an example</p>

<pre><code>&lt;div id="source"&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&lt;/div&gt;
&lt;div id="similar1"&gt;Lorem ipsum dolor&lt;/div&gt;
&lt;div id="similar2"&gt;consectetuer adipiscing elit&lt;/div&gt;
</code></pre>

<p>Now I want to match similar1 and similar2 with source div. The solution in above link suggests following code:</p>

<pre><code> $("#similar1").highlight("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.");
 $("#similar2").highlight("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.");
</code></pre>

<p>As you can see I have to repeat source text everytime. Is it possible to get contents directly from source div? i.e.</p>

<pre><code> $("#similar1").highlight($('#source').val());
</code></pre>
