I am currently trying to optimize a function I have and am looking to select both $(this) as well as $(#selector) or varName I have listed my code below to show an example, I have done some searching and cannot find anything specific.
$(varName, this).stop().animate({opacity : 1}, 'slow');
All help appreciated.
If you pass a second parameter to
$(), then jQuery will treat it as a context to search in. What you need is to build up a jQuery object using the.add()method as show below:$("#selector").add(this).add(varName).stop().animate({opacity : 1}, 'slow');