javascript - Form.onsubmit not working -


i'm creating script check in code. script runs on chrome, doesn't run on ie.

this run on onsubmit in form

<form id="frm1" name="frm1" method="post" onsubmit="return checkform();" action="save_dept_add.php">

and script (i've put in head tag)

<script language="javascript" type="text/javascript"> function checkform() {         if (!window.console) {              console = { log: function(){} };         }         var e = document.getelementbyid("dept");         var xtext = e.options[e.selectedindex].text;         if(xtext == ""){             console.log("no dept");             alert("please select department");                              return false;          }else{             console.log(xtext);             var q = document.getelementbyid("quantity");             var check = q.value;             console.log(check);             if(check == ""){                 alert("please insert quantity");                       return false;             }else{                 return true;                 }                }  } 

can tell me wrong?

add top of javascript file

if (!window.console) {    console = { log: function(){} }; } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -