It’s a common circumstance, but after a through Google + SO search, I have been unable to find a simple solution.. Although similar to this question, the point is not to amass a multi-dimensional array, but simply to ACT on whichever selector “Won”, not on the entire “sum” of selectors. Example:
var findThese = ['name', 'telephone', 'brasize'];
var chiXML = "<philly><name>sandy</name><brasize>49DDD</brasize></philly>"
+ "<philly><name>amber</name><telephone>976</telephone></philly>";
$(findThese).find(chiXML)
.parent()
.data(the_1of3_matched_selector_from_findThese, theMatched Text);
ending up with something vaguely like…
<philly data-name="sandy" data-brasize="49DDD">
<name>sandy</name><brasize>49DDD</brasize></philly>
</philly>....
Sorry if my example sucks… but what I’m getting at… is it possible to “transliterate” a list / array – as a “multiple choice” jQuery selector – which can then be acted with OR upon INDIVIDUALLY, during the callback / function portion of the query operation?
I think you want something like this:
If I understand you correctly, you need to know what part of a multiple selector your results match and act on that value.
You can break up the selector as I’ve done above and act on each piece independently, making it easier for you to know what part of the selector was satisfied.