【发布时间】:2019-02-23 20:51:32
【问题描述】:
这是我的 XML 文件。那里有三个author 节点:
<bookstore>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
</bookstore>
当我使用var author = $(this).find('author'); 时,author 将所有作者保存在一个字符串中。我想把它作为一个数组。有什么办法吗?
var author = $(this).find('author').toArray();
返回长度为 0 的数组
【问题讨论】:
标签: jquery xml xml-parsing