Jump to content

javascript null error


linux1880

Recommended Posts

why i am getting b is null error ?

 

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>createelement</title>
<script type="text/javascript" charset="utf-8">

var b = document.getElementById('clickme'),
count = 0;
b.onclick = function () {
count += 1;
b.innerHTML = "Click me: " + count;
};

</script>

</head>

<body>

<button id="clickme">click me </button>

</body>




</html>


Link to comment
https://forums.phpfreaks.com/topic/237702-javascript-null-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.