Created
January 3, 2013 20:22
-
-
Save pafnuty/4446822 to your computer and use it in GitHub Desktop.
[dlefaq] Переход к следующему полю при нажатии на клавшу -
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>следущее поле при keyup</title> | |
</head> | |
<style> | |
body { | |
width: 600px; | |
margin: 50px auto; | |
} | |
</style> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> | |
<script> | |
jQuery(document).ready(function($) { | |
$('#first').keydown(function(event) { | |
if ( event.which == 189 || event.which == 109 ) { | |
$('#second').focus(); | |
return false; | |
}; | |
}); | |
}); | |
</script> | |
<body> | |
<h1>Прмер события, вызываемого нажатием определёных клавиш</h1> | |
<form action="#"> | |
<input type="text" id="first" placeholder="нажмите - "> | |
<input type="text" id="second"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment