Submit.click() : submit button : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » submit button »

 

Submit.click()







The click() method simulates a click on the submit button. Note that if you have an onClick event handler assigned to this button, it will not be executed.












<html>
    <head>
    <script language="JavaScript">
    <!--
    function submitForm(){
      if(document.myForm.myText.value == ""){
        alert("Please enter some text first");
      }else{
        document.myForm.mySubmit.click();
      }
    }
    -->
    </script>
    </head>
    <body>
    <form name="myForm">
    Please Enter some text and click the link.<br>
      <input type=TEXT value="" name="myText">
      <input type=SUBMIT value="Submit" name="mySubmit">
    </form>
    <br>
    <a href="javascript:submitForm()">Click here to submit the form</a>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» submit button