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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -