68
rated 0 times
[
70]
[
2]
/ answers: 1 / hits: 5056
/ 10 Years ago, mon, april 28, 2014, 12:00:00
I want to be able to check to see if a specific data attribute exists that starts with a specific value.
for example lets say i have the following HTML code:
<div data-attr=123ABC></div>
<div data-attr=123456><div>
<div data-attr=TEST></div>
and then i want to find any use of the data tag of data-attr
that starts with 123
if ($('[data-attr=123]').length > 0) {
//do something
}
This appears to always return 0
as i have no data-attr=123
How would i make it so i can check for only that specific data attribute that starts with 123 and has anything after that?
More From » jquery