Home › Forums › CSS › jQuery .find() method in JS › Re: jQuery .find() method in JS
July 16, 2013 at 4:29 pm
#143219
pixelgrid
Participant
looking at the jquery source you can see that
jQuery.find = Sizzle;
where sizzle is the way jquery handles dom traversing
what you have in jQuery(‘selector1’).find(‘selector2’) is two dom traversals one applied to one element(might be document or a selected element) and the second applied to its children.
simple example
to get div.two in jquery with find
jQuery(‘.one’).find(‘.two’);
with plain js you can do
document.querySelector(‘.one’).querySelector(‘.two’)