jquery_2

1.bind()
bingding event handlers
like:$("div").bind("click",function(){alert("the div is clicked!");});

2.unbind()
unbinding the event handler;
like:$("div").unbind("click");

3.event.type,target,pageX,pageY
show the event attributes;
like:$("div").bind("click",function(event){
alert("Event type:" + event.types);
alert("Event pageX:" + event.pageX);
alert("Event pageY:" + event.pageY);
alert("Event taget innerHTML:" + event.target.innerHTML);
});

4.click(),blur();
also,we can bind the click or blur method directly use the two above functions;
like:$("div").click(function(){alert("I was clicked!");});

5.load(URL[,data][,callback_function])
we use this fucntion load to achieve the AJAX:load a file to a selector;
like:$("div").load("/jquery/result.html");

6.getJSON(URL[,data][,callback_funciton]);
we use this function to get JSON file and we can parse it to a JSON object;
like:$("div").click(function(){
$.getJSON("/jquery/result.json",function(jd){
$("div").html("<p>Name:" + jd.name + "</p>");
$("div").html("<p>Age:" + jd.age + "</p>");
$("div").html("<p>Sex:" + jd.sex + "</p>");
});
});

7.ajaxComplete(callback_function),ajaxStart(callback_function)
we use those function work finish or before the ajax works;

8.show(speed,callback),hide(speed,callback)
use this to show the selector;
like:$("#mydiv").show("slow",function(){alert(show finished!);});

9.toggle(speed,callback)
the function toggle achieves both show and hide;

10.fadeIn(speed,callback);fadeOut(speed,callback);
works just like the show and hide but with an effect of fade;

原文地址:https://www.cnblogs.com/zengneng/p/5539990.html