jQuery: Can I do $('.superset').$('.within') instead of $('.within', $('.superset'))?

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

I can't figure out how to prototype whatever it is $() returns, so that I can call $().$()

Thanks.

11.12.2008 01:48:29
2 ОТВЕТА
РЕШЕНИЕ

you can use find()

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

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

4
11.12.2008 01:50:22

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

Yes!

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

Now you can use .$()

0
16.08.2014 20:25:38