A simple utility module for cross browsers.
- Import the
seu-util.js
file in your html:
<script src="lib/seu-util.js"></script>
- Using the utility functions:
var myBtn = document.querySelector('#myBtn');
SeuUtil.event.addHandler(myBtn, 'click', function (event) {
console.log(event.type);
alert(this.value);
});
addHandler(element, type, handler)
removeHandler(element, type, handler)
getTarget(event)
preventDefault(event)
stopPropagation(event)