On running below code, getting following error - "Uncaught TypeError: Cannot set property 'onclick' of null"
<!DOCTYPE html>
<html>
<head>
<script>
document.getElementById("x").onclick = function() {
alert("clicked the button");
};
</script>
</head>
<body>
<button id="x">this is button</button>
</body>
</html>
element. Please google it you will find out why.
– Kai Oct 04 '14 at 06:52