I’m having trouble reading this xml with jQuery.
XML:
<myElements type="AA" coID="A923">
<element1>01</element1>
<element2>02</element2>
<element3>03</element3>
</myElements>
I’m looking for the following output:
element1=01
element2=02
element3=03
A little help please.
First, you need to wrap your
xmlvariable in a call to the jQuery function, as in$(xml). Then, a call tochildren()will get all of your target elements.Here’s a very basic (and sloppy), working example of iterating through the elements, but it’s just the selector that needs changing:
Working demo: http://jsfiddle.net/UByfW/2/