how to add jQuery click event using xPath?
This question already has an answer here:
This might help you.
stackoverflow link
function _x(STR_XPATH) {
var xresult = document.evaluate(STR_XPATH, document, null, XPathResult.ANY_TYPE, null);
var xnodes = [];
var xres;
while (xres = xresult.iterateNext()) {
xnodes.push(xres);
}
return xnodes;
}
$(_x('//div[@id="slideit"]/a[contains(@href, "javaScript:void(0)")]/..//following-sibling::div[1]')).css({
'color': 'red'
});
链接地址: http://www.djcxy.com/p/14720.html