Home > Web Front-end > JS Tutorial > Form focus order tabindex and corresponding enter key submission_Basic knowledge

Form focus order tabindex and corresponding enter key submission_Basic knowledge

WBOY
Release: 2016-05-16 17:44:41
Original
1393 people have browsed it

The focus tab order of the form: determined by tabindex. If the value is default, select the order. User:
Password:Correspond to the onsubmit event:

Copy the code The code is as follows :





Pay attention to the usage of return js:
Copy code The code is as follows:

function subUser(){
var username=$("#uname").val();
var password=$("#upwd").val();
var checkCode=$("#checkCode").val();
if(username==""){
$("#msg").html("Please enter your username!");
$("#uname").focus();
return false;
}else if(password==""){
$("#msg").html("Please enter Password!");
$("#upwd").focus();
return false;
}else if(checkCode==''){
$("#msg") .html("Please enter the verification code!");
$("#checkCode").focus();
return false;
}else{
document.loginform.submit();
return false;
}
return false;
}

Form gets focus event: $("#nameInput").focus()
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