Pop up wont work
HTML: <!DOCTYPE html> <html> <head> <title> title work </title> </head> <body> <!-- Modal/Popup --> <button id="myBtn">Password Requirments</button> <div id="myModal" class="modal"> <div class="modal-content"> <span class="close">×</span> <p>Some text in the Modal..</p> </div> </div> </body> </html> CSS: /* popup backround */ .modal { display:none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; backround-color: rgb(0,0,0); backround-color: rgb(0,0,0,0.4); } /*Popup Content */ .modal-content { backround-color: #fefefe; margin: 15% auto; padding: 20px; border: 1px solid #888; width: 80%; } /* Popup close button */ .close { color:#aaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: black; text-decoration: none; cursor: pointer; } JAVASCRIPT: // get the popup var btn = document.getElementById('myModal'); // button that opens the popup var btn = document.getElementById("myBtn"); // <span> to close popup var span = document.getElementsByClassName("close")[0]; // when the user clicks the buttion it opens the popup btn.click= function() { //problem is here and if i put a <script> in html i get a invisble token error modal.style.display= "block"; } ; // when user clicks on (x) it closes the popup span.onclick = function() { modal.style.display = "none"; } ; // when user clicks anywhere outside the popup it closes window.onclick = function(event) { if(event.target == modal) { modal.style.display="none"; } } ; My Problem: when i hit run i get this message, "Uncaught TypeError: Cannot set property 'click' of null Line:11" I can get rid of this problem by putting a <script></script> inside the html but that gets rid of the popup button and with the script in i get a token er