The following code was taking from the timers jQuery plugin demo. I don’t understand what is happening in the selector in line 2. It seems it is selecting the p element, but then what is the second argument after the comma – demos – there for?
jQuery:
var demos = $("div.wrapper div.demos");
$(".uncontrolled-interval p", demos).everyTime(1000,function(i) {
$(this).html(i);
});
HTML:
<div class="wrapper">
<div class="demos">
<div class="uncontrolled-interval">
<p>I am transient... *sigh*</p>
</div>
</div>
</div>
Thanks
It specifies the context of the search. Basically a filter.
http://api.jquery.com/jQuery#expressioncontext
So in this example it searches the
demoselement for.uncontrolled-interval p. If you have this markup, it would still only select the one indemos.