var slides = $('.slides'); function sec(a) {a.prop("checked",true)} $.each(slides,function() { setInterval(sec($(this)), 5000) });