 <p>jQuery selector returns an array of elements wrapped by a jQuery object. Using your code, <code>row</code> would represent a property of the object, which would work for the numeric properties; but would break for all the other properties (see below for why this is bad). </p> <p>Again, the following should not be used, but using your code, you would implement the <code>in</code> looping construct by caching your selector:</p> <pre><code>var $tr = $('#alertsbody &gt; tr'); for (var row in $tr) { // perform any property validation here if (isNaN(row)) continue; // try next property // id validation if ($tr[row].id == myRowId) . . . } </code></pre> <h2>Warning / Better Alternative</h2> <hr> <p>This is a bad idea. This is because you should not loop through the object in this manner, instead you should iterate over the jQuery object using <code>.each()</code>.</p> <pre><code>$tr.each(function(){ if(this.id == myRowId) ... }) </code></pre> <h2>Alternative</h2> <hr> <p>Some alternatives are to skip the loop entirely and select the rows by <code>id</code> eg(<code>$('#myRowId')</code> or <code>$('tr#myRowId')</code><em>though, tr is not necessary as there should only be one id per HTML page</em>) and perform some action. Or, if you already have some looping construct in place or need an alternative checking mechanism, you can use the <code>.is()</code> function:</p> <pre><code>var domElement = document.getElementById('myRowId'); var $jqElement = $('#myRowId'); $tr.each(function(){ var $this = $(this); if( $this.is('#myRowId') ) ... if( $this.is( domElement ) ) ... if( $this.is( $jqElement ) ) }); </code></pre>