form onSubmit return false doesn't work in Chrome
问题 My return false statement doens't work in Chrome when I want to check the user input through javasript. It fires the action tag even when I return false. Here's my code <script type="text/javascript"> function testInput(){ if(document.getElementById("input1").value == ""){ alert('error'); return false; }else{ return true; } } </script> The HTML <form action="exec.php" method="post" onSubmit="return testInput()"> <input type="text" id="input1" name="input1" /> <input type="submit" value="Exec"