I have a group of IDs with similar names (ex: div1, div2, div3) that are all going to perform the same function. Is there an easy way in jQuery to create an array by calling the prefix of the id ("div")?
3 Answers
You can use this attribute selector to test the start of the ID attribute value:
[id^=div]