im trying to do simple xpath with javascript on Grease monkey and it doesnt work for me,:
var xmlString="<body>text<table class='citizens largepadded'><tr><td>bla</td></tr><tr><td>needTHIStext</td></tr></table></body>";
var doc = new DOMParser().parseFromString(xmlString,'text/xml');
var result = doc.evaluate("//table[@class='citizens largepadded']/tr[2]/td[1]", doc, null, XPathResult.STRING_TYPE, null);
alert(result.stringValue);
how do i get text “needTHIStext” find with xpath and alert?
EDIT: thank you for pointing my stupid mistake 🙂 . It works now if anyone wants to do some xpathing 😉
it is the
FIRSTTD and not the second one.