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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -