Yes, $($(this)) same as $(this) , the jQuery() or $() function is wonderful idempotent . There is no reason for this particular design (this double packaging), however I use as a shortcut to capture the first element only from a group that includes a similar double packaging,
$($('selector')[0])
What is the sum, grab each element that matches the selector , (which returns the jQuery object), then use [0] to grab the first in the list (which returns the DOM object), then wrap it in $() again to return it back to jQuery object, which this time contains only one element instead of a collection. This is roughly equivalent
document.querySelectorAll('selector')[0]; , which is pretty much document.querySelector('selector');
chiliNUT Feb 10 '14 at 7:32 2014-02-10 07:32
source share