中央論壇 - CENTER BBS

標題: JQuery - XML 處理簡單基礎範例 - eq()抓取陣列 物件化處理方式 [打印本頁]

作者: 死神    時間: 2013-11-26 17:49
標題: JQuery - XML 處理簡單基礎範例 - eq()抓取陣列 物件化處理方式
適用JQuery目前版本,範例以1.10.2為例:
  1. var x = $(
  2.         "<products><product id=\"A\">Im A</product>" +
  3.         "<product id=\"B\">Im B</product>" +
  4.         "<product id=\"C\">Im C<detail>COOL</detail></product></products>");
  5.     alert(x.find("product:eq(0)").attr("id"));
  6.     alert(x.find("product").eq(2).find("detail").text());
複製代碼
有不懂可告知再註解~




歡迎光臨 中央論壇 - CENTER BBS (https://www.centerbbs.com/) Powered by Discuz! X3