Skip to content

Instantly share code, notes, and snippets.

@pafnuty
Created January 3, 2013 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pafnuty/4446822 to your computer and use it in GitHub Desktop.
Save pafnuty/4446822 to your computer and use it in GitHub Desktop.
[dlefaq] Переход к следующему полю при нажатии на клавшу -
<!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