Reputation: 446
For example, in the elements below, what selector would find everything with a value of "value2", regardless of the attribute's name?
<div data-name1="value1"></div>
<div data-name2="value2"></div>
<div data-name3="value2"></div>
<div data-name4="value1"></div>
Upvotes: 0
Views: 142
Reputation: 558
May I suggest having a specific attribute and then searching that specific attribute value?
HTML
<div data-name="value1"></div>
<div data-name="value2"></div>
<div data-name="value2"></div>
<div data-name="value1"></div>
CSS
[data-name^='value2'] {
background-color:red;
}
Upvotes: 1