I've been using CSS3 selectors to select specific elements based on their attributes, although today, I have programmed myself into a corner, where I need a select a specific element based on the presence of TWO different attributes, instead of only 1.
e.g. I need to select the first div.
<div data-foo="bar" data-bar="baz"> <div data-foo="bar" data-bar="lorem"> <div data-foo="ipsum" data-bar="baz">
Just for fun, I tried
div[data-foo="bar", data-bar="baz"], but not surprisingly, that didn't work.
Is there any way for me to get that specific element?
Right now, the only solution I can think of is to select all elements with the correct
data-foo attribute, and then loop through the results to find the element with the correct