What does this line do $('.item').attr('value', myTime).show(); , captures all item elements, setting attr with myTime for all .item elements and starting the show.
If you need a better selector, namely attribute equals
$('.item[value="' + myTime + '"]')
Another way to do this that will not result in a query in dom again is to set the timers in a simple each() loop.
You should use data-* attributes, which may work better for you with jQuery.
Besides doing this in full seconds, you will also work with this value.
<div class="content"> <div class="item" data-seconds="15"> <p>Some text</p> </div> <div class="item" data-seconds="30"> <p>More text</p> </div> <div class="item" data-seconds="60"> <p>Even more text</p> </div> </div> $("div.item").hide().each(function(index, item){ var $item = $(this); setTimeout(function(){ $item.show(); }, $item.data("seconds") * 100); });
Jsfiddle example
source share