showing results for - "select xml child element with jquery"
Rafael
19 Sep 2016
1var xmlString = "<route><name>Lakeway</name><abrv>LAKE</abrv><eta><time>00:30</time><dest>MAIN</dest></eta></route>",
2xmlDoc = $.parseXML( xmlString ),
3$xml = $( xmlDoc ),
4$abrv = $xml.find( "abrv" ).text() == "LAKE" ? $xml.find( "abrv" ) : false;
5
6var time = $abrv.next().children("time").text();
7var dest = $abrv.next().children("dest").text();
8
9alert(time + " " + dest);