首页 > 其他 > 详细

验证一个表单需要干的事情

时间:2015-08-05 12:44:34      阅读:218      评论:0      收藏:0      [点我收藏+]

1. 当元素失去焦点时发生 blur 事件。

$("input").blur(function(){
alert("This input field has lost its focus.");
});

 

http://www.runoob.com/jquery/event-blur.html

 

2. 当输入框获取焦点的时候,触发的事件。

$("input").focus(function(){
$("span").css("display","inline").fadeOut(2000);
});

 

http://www.runoob.com/jquery/event-focus.html

 

3. 当键盘键被松开时发生 keyup 事件。

$("input").keyup(function(){
$("input").css("background-color","pink");
}); 

 

http://www.runoob.com/jquery/event-keyup.html

 

4. 当表单提交的时候触发的事件。

$("form").submit(function(){
alert("Submitted");
}); 

http://www.runoob.com/jquery/event-submit.html

 

 

JQuery 的事件列表:http://www.runoob.com/jquery/jquery-ref-events.html

 

验证一个表单需要干的事情

原文:http://www.cnblogs.com/liuhongfeng/p/4704222.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!