samedi 26 avril 2014

Find a sub-node from a node by xpath


Vote count:

0




I need to go through some fields and print out the texts. However, I can't find a function that can output a sub-node given a node and the xpath to that sub-node.


In the following code snippet, I used the non-existing function "getSubnode". Would appreciate if someone could give me a hint on how to implement it.



x = $('div.content');
for (i=0; i<x.length; i++) {
y1 = getSubnode(x[i], "span/strong");
y2 = getSubnode(x[i], "a/strong");
console.log(y1.textContent, y2.textContent)
}


Thanks!



asked 24 secs ago






Aucun commentaire:

Enregistrer un commentaire