is there a way in jQuery to select elements that have a certain value in a data attribute array?
Consider this snippet of html:
<li id="person1" data-city="Boston, New York, San Fransisco">
Person name 1
</li>
<li id="person2" data-city="Los Angeles, New York, Washington">
Person name 2
</li>
What is the best way in jQuery to select all persons with "New York" in the data-city attribute?
The solution should take in account that certain citynames appear in other city names (in example 2: London, New London)
Example 2:
<li id="person1" data-city="Boston, London, San Fransisco">
Person name 1
</li>
<li id="person2" data-city="Los Angeles, Washington, New London">
Person name 2
</li>
What is the best way in jQuery to select all persons with "London" in the data-city attribute? A city with "New London" should not be selected.