Reputation: 11469
A lot of frameworks implement their own attributes (ng-
, v-
, bind-
, etc.) Is there a way to select elements that have attributes starting with some string? (without looping through all elements and their properties)
Upvotes: 3
Views: 194
Reputation: 177
You can use these methods to do this :
Let's say you have <div class="exampleDiv">
, you can catch the div element with $("div:regex(class, exa.*)")
. (NB: exa.*
is your regex...)
$('[id^=start]')
matches elements with id attribute starting with start
$('[id$=end]')
matches elements with id attribute ending with end
Upvotes: 2