xpath - limit search to node not working?

Posted by Mr W on Stack Overflow See other posts from Stack Overflow or by Mr W
Published on 2010-05-11T08:25:02Z Indexed on 2010/05/11 8:54 UTC
Read the original article Hit count: 232

Filed under:
|
|

What am I doing wrong here? I am trying to limit my xpath search to a specific row in my table but my query always returns the content of the span in the first row:

var query = "//span[contains(@id, 'timer')]";
var root = document.getElementById('movements').rows[1];
document.evaluate(query, root, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.textContent

Please help!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about xpath