动态绑定事件:
$("input[name='username']").unbind("blur");
$("input[name='username']").bind("blur", function(){
user.checkUser($(this).val());
});
ajax请求:
$.ajax({
type:"POST",
cache: false,
url:'userJSONAction_checkUsername.action',
data:parameter,
beforeSend: function(XMLHttpRequest){
alert("请求将要开始,我们可以在此处显示加载条");
},
success:function(data){
alert(data);
},
complete: function(XMLHttpRequest, textStatus){
alert("请求完毕了,我们可以隐藏加载条 ");
},
error:function(XMLHttpRequest){
alert("请求失败了 "+XMLHttpRequest.status);
}
});
$.post("menuitemAction_showMenuitemsByPid.action", parameter, function(data){
tree.zTree = $("#tree").zTree(tree.setting, data.menuitemList);
});
页面加载时执行:
$().ready(function(){
alert('asdf');
});
$(function(){
alert('asdf');
});
jquery之for循环:
$("#colors a").each(function(){
$(this).attr("class","changToWhite");
});