JQuery: can i use $ ('superset'). $ ('. inside') instead of $ ('. inside', $ ('. superset'))?

Can jQuery be extended so that I can use the above syntax?

I cannot figure out how to prototype everything that $ () returns, so that I can call $ (). $ ()

Thank.

+1


source to share


2 answers


you can use find()

eg: $('.superset').find('.within');



or much easier, $('.superset .within');

+4


source


Can jQuery be extended so that I can use the above syntax?

Yes!



$.fn.$ = $.fn.find;

      

Now you can use .$()

0


source







All Articles