jQuery: array zero vs function get zero: [0] vs get(0) -
is there reason should use $('#x>div').get(1)
when instead use $('#x>div')[1]
? there difference?
nope, no difference. jquery holds dom nodes in array.
$().get(1)
=== $()[1]
--jquery source snippet--
get: function( num ) { return num == null ? // return 'clean' array this.toarray() : // return object ( num < 0 ? this[ this.length + num ] : this[ num ] ); },
as can see, .get()
no arguments return nodes array. cannot accomplished brackets.
Comments
Post a Comment