I am using the following jQuery XPath to find any element with the attribute “pathname” (a variable that takes the page location from the URL).
var local_url = "*[url=" + pathname + "]";
However, I now want to find whether this variable exists in one of two element attributes: url or alturl. How would I phrase this in XPath syntax so I don’t have to use an if/else statement? (Eg, find all attributes where url=pathname OR alturl = pathname.)
Thanks!
You can use a multiple selector to find elements with either attribute matching, for example: