Move your script
to the end of the body
or wrap it in a DOM ready function. Your getElementById
is executing before the page is rendered, thus throwing a null error.
Example:
$(document).ready(function(){
var usr = document.getElementById("textbox1").value;//error is over this line.
if(usr.length<=6){
$("#press").click(function(){
$("#warning").toggle();
});
}
});