an array of strings as a jQuery selector?
Posted
by dalbaeb
on Stack Overflow
See other posts from Stack Overflow
or by dalbaeb
Published on 2009-06-16T15:03:05Z
Indexed on
2010/06/12
20:12 UTC
Read the original article
Hit count: 159
JavaScript
|jQuery
I have an array of strings that are valid jQuery selectors (i.e. IDs of elements on the page):
["#p1", "#p2", "#p3", "#p4", "#p5"]
I want to select elements with those IDs into a jQuery array. This is probably elementary, but I can't find anything online. I could have a for-loop which creates a string "#p1,#p2,#p3,#p4,#p5"
which could then be passed to jQuery as a single selector, but isn't there another way? Isn't there a way to pass an array of strings as a selector?
EDIT: Actually, there is an answer out there already.
© Stack Overflow or respective owner