javascript button handler code example
Example 1: how to add onclick event in javascript
var element = document.getElementById("elem");
element.onclick = function(event) {
console.log(event);
}
Example 2: onclick a tag
<a href='http://www.google.com' onclick='return check()'>check</a>
<script type='text/javascript'>
function check() {
return false;
}
</script>