Skip to content

Instantly share code, notes, and snippets.

@yohanboniface
Last active August 29, 2015 14:01
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 yohanboniface/fe8f43fe2f5c497b9579 to your computer and use it in GitHub Desktop.
Save yohanboniface/fe8f43fe2f5c497b9579 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<head>
<title>Input color events test case</title>
</head>
<body>
<input type="color" name="myinput" />
<div id="events"></div>
<script type="text/javascript">
var el = document.querySelector('input[type=color]'),
output = document.querySelector('div#events');
function log (e) {
output.innerHTML = output.innerHTML + e.type + ' - value is: ' + el.value + '<br />';
}
el.addEventListener('input', log);
el.addEventListener('change', log);
el.addEventListener('update', log);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment