We would like to know how to handle two events with single event handler function.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.10.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!-- w w w . j a v a 2 s . c om-->
$('input').on('mouseenter keypress', function () {
console.log(this.id);
});
});
</script>
</head>
<body>
<form>
<input type="text" id="name" /> <input type="text" id="surname" /> <input
type="password" id="pass" />
</form>
</body>
</html>
The code above is rendered as follows: