I have two elements that I would like to select
<input id="iMe" /> and <span id="sMe">Blah</span>
I would like to select them both:
$("span[id$='Me']") and $("input[id$='Me']")
in one selector. I've tried:
$("span,input[id$='Me']") -> Nope
$("span[id$='Me'],input[id$='Me']") -> Nope
$("span[id$='Me']input[id$='Me']") -> Nope
I wouldn't mind just adding it to the collection either. I definitely don't want to create more script to hack around this. Any ideas?
This really should work as well as the add() method, so maybe you have a problem somewhere else? Some ancient version of jQuery perhaps?
Why not give the two elements a class?
then
?
Example page: http://jsbin.com/idali (view/edit source at http://jsbin.com/idali/edit)
The following variations should all work:
(edit: the original answer below is wrong; quotes are optional but allowed...)
You've got too much quoting in your attempts... You wantAttribute values are not quoted in css selectors.
should work. But watch out for the performance as this will have to go through the entire DOM.