一、找到你了$("")=document.getElementById(""); $("#myDiv")

XPath

$("divp")

$("div.container")

$("div#msg")

$("tablea",context)得到context为上下文的table里面所有的连接元素。

二、JQUERY对象

jquery提供了很多便利的函数,如each(fn),但是使用这些函数的前提是:你使用的对象是Jquer对象。

1.vara=$("#cid");

2.varb=$("<p>hello</p>");

3.varc=document.createElement("table");vartb=$(c);

三、代替body标签的onload

#(document).ready(Fn);

四、事件机制

$(document).ready(

function(){

$("#clear").click(function(){

alert("test");

$("form[0]").submit(validate);

});

});

function validate(){}

五、同一函数实现set&get

$("#msg").html();

$("#msg").html("hello");

六、ajax

$.get("search.do",{id:3},function(){//回调函数});

$.post("search.do",{id:4},function(){//回调函数});

$("#msg").ajaxStart(function(){});

$("#msg").ajaxSuccess(function(){});

七、渐入淡出

1.$("#msg").fadeIn("fast");

2.$("#msg").fadeOut("slow");

上面两行代码已经分别实现了一个id为Msg的jquery对象的渐入和淡出。做一个像Gmail一样的动态加载通知条,用jquery就那么简单。两个函数接受的参数除了快慢等,还可以接收整型,作为渐入或淡出的完成时间,单位为MS。

八、plugin

这也是一个插件的时代。

jquery插件给我的感觉清一色的清洁,简单。如Jtip,要使用它的功能,只需要在你的元素的class上加上Jtip,并引入jtip.js及其样式即可以了。

加一些Jquery的资源:

http://www.visualjquery.com/index.xml很好的API查询站点

http://jquery.com/demo/thickbox/知道lightBox吧,看看Jquery是怎样实现相同的东西

http://www.codylindley.com/blogstuff/js/jtip/Jtip,实用的提示工具

http://jquery.com/plugins/很多牛的插件。

http://15daysofjquery.com/jquery的15天教程