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>
站长行业门户(www.software8.co)文章,希望大家可以留言建议