If I have an unknown amount of identifiers sharing a specific naming-scheme, is there a way to grab them all at once using jQuery?
// These are the IDs I'd like to select
#instance1
#instance2
#instance3
#instance4
// What do I need to add or how do I need to modify this jQuery selector in order to select all the IDs above?
("#instanceWILDCARD").click(function(){}
The attribute starts-with selector (
'^=) will work for your IDs, like this:However, consider giving your elements a common class, for instance (I crack myself up)
.instance, and use that selector: