Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery mobile form submit. Simple form that takes user to page on form submit
    text
    copied!<p>I'm struggling with a form submit in jquery mobile and the api doesn't show any useful examples.</p> <p>Here is my html:</p> <pre><code>&lt;div data-role="page" id="test" data-id="test"&gt; &lt;div data-role="content"&gt; &lt;form id="form1"&gt; &lt;div id="titleDiv" data-role="fieldcontain"&gt; &lt;label id="titlelabel" for="title"&gt;Title *&lt;/label&gt; &lt;select id="title" name="title"&gt; &lt;option value="null"&gt;Please select a title&lt;/option&gt; &lt;option value="mr"&gt;Mr&lt;/option&gt; &lt;option value="miss"&gt;Miss&lt;/option&gt; &lt;option value="mrs"&gt;Mrs&lt;/option&gt; &lt;option value="ms"&gt;Ms&lt;/option&gt; &lt;option value="dr"&gt;Dr&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div id="submitDiv" data-role="fieldcontain"&gt; &lt;input type="submit" value="Submit Form" data-inline="true"/&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;div data-role="page" id="test" data-id="test"&gt; &lt;p&gt;form confirmation page&lt;/p&gt; &lt;/div&gt; </code></pre> <p>and here is my javascript:</p> <pre><code>$('div').live('pageshow',function(event, ui) { $('#form1').submit(function() { alert('test'); // Submit the form // $.post("/forms/requestProcessor.php", form1Var.serialize(), function(data){ // }); $.mobile.changePage($("#test"), "slideUp"); return false; }); }); </code></pre> <p>On submit, I want it to show an alert then take the user to a page. At the moment, that code shows the alert 3 times the does nothing. Any ideas what is wrong with it?</p>
 

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