首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

jQuery怎么工作

2012-12-17 
jQuery如何工作jQuery如何工作首先,你需要下载jQuery的一个副本,并在你的HTML页面(最好在插入HEAD标签)。

jQuery如何工作
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 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)文章,希望大家可以留言建议

热点排行