Find xml attribute values with javascript(使用 javascript 查找 xml 属性值)
问题描述
如何使用 Javascript/jQuery 获取 XML 节点的属性值?
How do I get the attribute value of an XML node with Javascript / jQuery?
我正在尝试获取节点上duration属性的值,然后获取fixedValue.
I'm trying to get the value of the duration attribute on the node, then get the fixedValue.
到目前为止,我得到了:
So far I've got:
第二个 console.log 打印 undefined.
The second console.log prints undefined.
推荐答案
我遇到的第一个问题是 currLoadXml 不是字符串.它需要用单引号括起来.
The first problem I ran into is that currLoadXml is not a string. It needs to be wrapped inside single quotes.
试试下面的方法
这篇关于使用 javascript 查找 xml 属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!