我正在尝试遍历 xml 文档。这不起作用(零结果):
jquery("foo bar")
这确实有效:
jquery("foo").find("bar")
知道为什么吗?
jquery("foo bar")
第一个查找 bar 元素是 foo 元素的后代
所以在这个例子中它会起作用
<foo>
<div>Form is surrounded by the green outline</div>
<label>Child:</label>
<bar name="thisone" />
<fieldset>
<label>Grandchild:</label>
<bar name="thisone2" />
</fieldset>
</foo>
这个使用a进行搜索jquery表达式 http://docs.jquery.com/Selectors
jquery("foo").find("bar")
从所有 foo 元素开始并搜索后代 bar 元素
所以在这个例子中它会起作用
<foo><bar>found</bar>, not here?</foo>
<foo>not here <bar>found</bar>.</foo>
所以没有你的标记就无法真正指定你的问题
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)