Note that there are some explanatory texts on larger screens.

plurals
  1. POhtml form submission difference between click(), submit() and manual click in jquery
    primarykey
    data
    text
    <p>I have a jsp page as follows:</p> <pre><code>&lt;script type="text/javascript" src="/mywebapp/js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $( function() { $('#testform').submit(function(){ alert('now starting submit'); return true; }); $("#test1btn").click(function(){ $('#testform #submit').click(); }); $("#test2btn").click(function(){ $('#testform').submit(); }); }); &lt;/script&gt; &lt;form id="testform" method="post" action="backend/search_test.do"&gt; &lt;input id="reqpagenr" name="reqpagenr" size="10"&gt; &lt;input type="button" id="test1btn" value="TestClick"/&gt; &lt;input type="button" id="test2btn" value="TestSubmit"/&gt; &lt;input id="submit" type="submit" value="Go"&gt; &lt;/form&gt; </code></pre> <p>When I manually click (i.e. using a mouse) the button "Go", the form is submitted after displaying the text "now starting submit"; when click the button "TestClick", the form is successful submitted but the text "now starting submit" doesn't come up; when click the button "TestSubmit", the text "now starting submit" appears, but the form is not submitted at all. </p> <p>Contrary to my expections, the buttons "TestClick" and "TestSubmit" do not function as the button "Go" does when both are clicked. In my understanding, the three button clicks should do the same thing, that is, to submit the form after the text "now starting submit" appears. So my question is, why the results of the three button clicks is different?</p> <p>I am using jquery 1.3.2</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload