How do I select elements with attributes that start with something?
1 answer
You can use these methods for this:
-
Padolsey special filter (see Padelsey regexp: filter )
Let's say you have
<div class="exampleDiv">
you can catch a div element with$("div:regex(class, exa.*)")
. (NB:exa.*
is your regex ...) -
Native jQuery selectors
$('[id^=start]')
matches elements with an id attribute starting at the beginning$('[id$=end]')
matches elements with an id attribute ending at the end
+2
source to share