📜  使用 jQuery 选择 xml 子元素 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:34.960000             🧑  作者: Mango

代码示例1
var xmlString = "LakewayLAKEMAIN",
xmlDoc = $.parseXML( xmlString ),
$xml = $( xmlDoc ),
$abrv = $xml.find( "abrv" ).text() == "LAKE" ? $xml.find( "abrv" ) : false;

var time = $abrv.next().children("time").text();
var dest = $abrv.next().children("dest").text();

alert(time + " " + dest);