Last active
August 29, 2015 14:13
-
-
Save geedew/2876f7d17ca9de32b85f to your computer and use it in GitHub Desktop.
HTML Change/KeyUp events vs Input event
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
<!-- index.html --> | |
<input id='abc'/> | |
<script> | |
var input = document.getElementById('abc'); | |
input.addEventListener('change', function(event) { | |
// .. only triggers on input loss of focus | |
}); | |
input.addEventListener('keyup', function(event) { | |
// .. triggers on any keyboard interaction | |
}); | |
</script> |
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
<!-- index.html --> | |
<input id='abc'/> | |
<script> | |
var input = document.getElementById('abc'); | |
input.addEventListener('input', function(event) { | |
// .. some action logic | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment