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
158 第四章
調整
DOM
replaceWith 並不適合所有狀況
replaceWith
好, 如, hamburger
portbello 類別。
多對一替換
多對一替換
然而,檢 單的下一 目的元素
換並非 一,我們必 使 用一種材
( )
( 亦即,火雞,蛋,牛排,羊肉 )
一對多替換
一對多替換
我們可以取出 meat
類別的元素,並且
用豆腐替換它們。
但是,當 想要選擇 並且在稍
替換它 時, 碰到一個 題。 當我們想
的「肉」
【譯 註】
時,
DOM 已經忘記它們了。
我們可以只用一種「肉」替換豆腐,但那
樣根本不是我們想要的。
因此,我們必須用兩個步驟完成這個菜單
替換工作︰
稍後,DOM 已經
忘了所有不同種
類的「肉」。
tofu
類別的
li
元素插入
DOM
meat
類別的元素後面。
解除
meat
類別的元素並且將它們
儲存在變數中。
一對一替換
?
?
?
4
譯註提醒讀者,在此「肉」指的是 hamburger fish
之外的所有葷食材料。
1
2
目前位置 4 159
jQuery 網頁操作
HTML 內容插入 DOM
tofu
類別的
li
元素插入
DOM
裡頭
meat
類別的元素後面。
解除
meat
類別的元素並且將它
們儲存
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