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