通过xpath从节点中查找子节点

时间:2014-04-27 02:37:33

标签: javascript jquery

我需要浏览一些字段并打印出文本。但是,我找不到一个函数可以输出给定节点和xpath到该子节点的子节点。

在下面的代码片段中,我使用了不存在的函数“getSubnode”。如果有人能给我一个如何实现它的提示,我将不胜感激。

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)
}

谢谢!

0 个答案:

没有答案