<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<script data-require="jquery@3.1.1" data-semver="3.1.1" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<form>
<label>Input 1</label>
<input type="text">
</form>
<form>
<label>Input 2</label>
<input type="text">
<br>
<label>Input 3</label>
<input type="text">
</form>
<script src="script.js"></script>
</body>
</html>
$('input').on('keydown', function(event) {
alert('keydown');
console.log(event);
});
form {
position: relative;
border: 1px dashed #bbb;
padding: 26px 10px 0;
margin-bottom: 10px;
}
form:before {
content: '<form>';
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
height: 26px;
line-height: 26px;
background: #e3e3e3;
padding: 0 5px;
}