Whats wrong in my code ? The output is to be as if both username and password are empty it should alert no blank else proceed
<!DOCTYPE html> <html> <head> <title>Page Title</title> <script type="text/javascript"> function fn1() { var str1=document.getElementById(text1).value; var str2=document.getElementById(text2).value; if(text1.value ==" "|| text2.value =="") { alert(" no blank"); return false ; } else{ alert(" proceed"); return true; } } </script> </head> <body> <form onsubmit="return fn1()" > <input type= "text" id=" text1" placeholder=" usernamw"><br /> <input type= "password" id=" text2" placeholder=" password"><br /> <button type="submit">submit</button> </form> </body> </html>