jQuery checking the length of array before each? -


quick question, need if statement .length below?

var $colspans = $("td[colspan='0']"); if($colspans.length){     $colspans.each(function(){ 

no, since length 0 ans it's not $colspans null, you're not in danger of trying call on nothing. won't iterate because there's nothing to iterate over.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

React Native allow user to reorder elements in a scrollview list -