jQuery如何工作
首先,你需要下載jQuery的一個副本,并在你的HTML頁面(最好在插入<HEAD>標簽)。然后,你需要寫函數來告訴jQuery的做什么。下面的圖表說明了jQuery如何工作的細節:
如何獲得元素?
編寫jQuery函數是比較容易的(感謝精彩的??文檔)。關鍵的一點,你必須要學會的是如何得到確切的元素,你要申請的影響。
$("#header") = get the element with id="header"
$("h3") = get all <h3> element
$("div#content .photo") = get all element with class="photo" nested in the <div id="content">
$("ul li") = get all <li> element nested in all <ul>
$("ul li:first") = get only the first <li> element of the <ul>
本站僅提供存儲服務,所有內容均由用戶發布,如發現有害或侵權內容,請
點擊舉報。