Home > Backend Development > PHP Tutorial > jQuery回车登陆不会写

jQuery回车登陆不会写

WBOY
Release: 2016-06-23 13:31:11
Original
835 people have browsed it

小弟想做个回车登陆的效果但是老是没出效果,望大家帮忙看看问题在哪谢谢了

</script>$(document).keyup(function(event){		if(event.keyCode ==13){		alert("1");	});</script><form id="loginform" method="post" action="?ac=login" enctype="multipart/form-data">
Copy after login


回复讨论(解决方案)

$(function() {  $(document).keyup(function(event){    if(event.keyCode ==13){      alert("1");    }  });});
Copy after login
这样比较好
$(function() {  $("#loginform").keyup(function(event){    if(event.keyCode ==13){      alert("1");    }  });});
Copy after login

如果你的alert(1)弹的出来的话,如下代码:

$("#loginform").submit();  就可以了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template