I want to combine these two statements into one.
$("#thing1, #thing2").toggleClass('myClass');
$(this).toggleClass('myClass');
Instincts told me this might work:
$("#thing1, #thing2", this).toggleClass('myClass');
but after some research, I discovered it is equivalent to this:
$(this).find("#thing1, #thing2").toggleClass('myClass');
I can’t find anything in the documentation about doing this.
2
Answers
Have a look at add():
You could use
$.merge