What is the difference between
var row1 = $('tr').get(0);
and
var row2 = $('tr').eq(0);
jQuery eq() Method The eq() method returns an element with a specific index number of the selected elements. The index numbers start at 0, so the first element will have the index number 0 (not 1).
get(0)
returns the first DOM element matched by the selector.
eq(0)
returns a jQuery object containing the first DOM element matched by the selector.
In other words, $("selector").get(0)
is equivalent to $("selector").eq(0).get(0)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With