簡體   English   中英

以標簽開頭獲取XML的所有元素

[英]Get all elements of an XML with a tag starting with

我有這個XML:

<computers>
    <computer sid="1353323295303">
        <description>TEST</description>
        <match.country result="match" value="FR EU">
            <match.country result="match" value="EU"></match.country>
        </match.country>
    </computer>
</computers>

如何選擇所有以“匹配”開頭的標簽。

謝謝

您可以使用filter方法:

var $match = $('computers *').filter(function() {
    return this.localName.indexOf('match') === 0
})

http://jsfiddle.net/UmUkj/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM