Highlighting word by word using jquery
<p>How to highlight the text in div at particular time interval. The time interval has been mentioned in "intervals" attribute of the each div. Is it possible to change interval the time as dynamically in setInterval or setTimeout function. I have written the structure of the HTML and jquery code that I am using.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
  .green_class{
   background-color:green;
  }
&lt;/style&gt;

&lt;script type="text/javascript"&gt;
   $(document).ready(function(){
     $("#btnclick").click(function(){
        var childs=$("#test").children();
        $(childs).each(function(){
         var time_interval=$(this).attr("intervals");
         setTimeout(function(){$(this).addClass("green_class");},parseInt(time_interval));
        });
     });
   });
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id="test" style="float:left"&gt;
        &lt;div intervals="0"&gt;Lorem&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="500"&gt;Ipsum&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="800"&gt;is&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="1000"&gt;simply&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="1200"&gt;dummy&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="1400"&gt;text&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="1600"&gt;of&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="1800"&gt;the&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="2000"&gt;printing&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="2200"&gt;and&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="2400"&gt;typesetting&amp;nbsp;&lt;/div&gt;
        &lt;div intervals="2600"&gt;industry&lt;/div&gt;
    &lt;/div&gt;
&lt;input type="button" value="Highlight" id="btnclick"/&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The above script is not working properly. Is it possible to change the setTimeout function time duration dynamically. Please give your valuable suggestions/solutions.</p>
