Sebastien
Sebastien

Reputation: 6660

Get all elements of an XML with a tag starting with

I have this 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>

How can I select all tags starting with "match."

Thank you

Upvotes: 0

Views: 96

Answers (1)

Ram
Ram

Reputation: 144689

You can use filter method:

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

http://jsfiddle.net/UmUkj/

Upvotes: 1

Related Questions