loops - Jquery each return only first found element -
var x = $(".tabulardata tr").each(function(){ if($(this).hasclass("even")||$(this).hasclass("odd")){ return first found element, weather or odd current code returning elements //return $(this); } });
return $(this)
return elements even|odd whereas need return first found element.
if 'm not misunderstanding intent, can more with
var $x = $(".tabulardata tr").filter(".odd, .even").first();
however, need "odd or even" test? since every row either odd or even, sounds simpler do
var $x = $(".tabulardata tr:first");
Comments
Post a Comment