Skip to Content
深入淺出 jQuery
book

深入淺出 jQuery

by Ryan Benedetti, Ronan Cranley
February 2012
Intermediate to advanced
540 pages
11h 39m
Chinese
GoTop Information, Inc.
Content preview from 深入淺出 jQuery
306 第八章
請傳遞資料
剖析 XML 資料
我們需要 法,從我們的 XML 檔案中挑出每個跑者並且 上展示它。幸運
是,jQuery find 法, 合我 們所 指定 之任 素。find
我們 組階層 構資訊(如 DOM 構或 XML 件)裡 元素及 子孫元
素,並且利用 符合的元素建構出新的 陣列。find children 方法類似(我們在第 4
Webville Eatery 建立菜單時看過 children 方法),除了後者只能夠沿著 DOM 樹狀
結構向下深入一層之外。另外,我們可能還需要更進一步…
透過結合find方法與
each 方法,我們能夠搜
尋一組元素,並且利用迴
圈個別地與每一個互動。
你能夠想到我們需要跟
XML
文件的哪個片段互動,
以便將個別的跑者展示在畫面上?
$("li").find("ul").css('background-color', 'blue');
這可以是任何選擇器。
這可以是任何其他 jQuery 方法,
像是事件、文字或樣式的操控器。
這可以是任何選擇器,或者
jQuery 元素的群集或群組。
li
li
li
li
li
li
li
li
li
li
li
ul
ul
ul
ul
$(“li”).find(“ul”)
這會找出被包含在任何 li 元素裡的
所有 ul 元素,並且將它們的背景顏
色設成藍色。
li
li
ul
li
目前位置 4 307
jQuery
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

HTML5 錦囊妙計

HTML5 錦囊妙計

Christopher Schmitt, Kyle Simpson
Pro JSF and HTML5: Building Rich Internet Components, Second Edition

Pro JSF and HTML5: Building Rich Internet Components, Second Edition

Hazem Saleh, Allan Lykke Christensen, Zubin Wadia

Publisher Resources

ISBN: 9789862764060