读书人

详解jQuery是怎么工作的

发布时间: 2012-08-21 13:00:21 作者: rapoo

详解jQuery是如何工作的
jQuery如何工作首先,你需要下载jQuery的一个副本,并在你的HTML页面(最好在插入<HEAD>标签)。然后,你需要写函数来告诉jQuery的做什么。下面的图表说明了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>

读书人网 >编程

热点推荐