Skip to content

Instantly share code, notes, and snippets.

@geedew
Last active August 29, 2015 14:13
Show Gist options
  • Save geedew/2876f7d17ca9de32b85f to your computer and use it in GitHub Desktop.
Save geedew/2876f7d17ca9de32b85f to your computer and use it in GitHub Desktop.
HTML Change/KeyUp events vs Input event
<!-- 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>
<!-- 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