jQuery is it possible to concatenate two selector variables?
Posted
by
Kris Hollenbeck
on Stack Overflow
See other posts from Stack Overflow
or by Kris Hollenbeck
Published on 2012-09-06T21:33:55Z
Indexed on
2012/09/06
21:38 UTC
Read the original article
Hit count: 250
jQuery
Lets say I have two variables defining separate selectors, for example...
var parent = $('.parent');
var child = $('.child');
And I want to create a something like the following...
$(parent + child).click();
Which should be equivalent to doing this (if it was correct syntax)...
$('.parent .child').click();
This may not be best practice, however I am curious if it is possible. Thanks for your help in advance.
© Stack Overflow or respective owner