Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6959575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:17:23+00:00 2026-05-27T15:17:23+00:00

I am using <input type=search /> textboxes in a jQuery Mobile site. JQM provides

  • 0

I am using <input type="search" /> textboxes in a jQuery Mobile site. JQM provides great functionality right out of the box for these types of fields that I would like to keep, however, I’ve hit a snag.

I have the unfortunate constraint of having to create my mobile site within ASP.NET WebForms. Consequently, all of my markup is wrapped in one uber form element.

Now, when you go to enter text into a search input in Mobile Safari, the iPhone/iPad will present a nifty “Search” button at the bottom of the keyboard. This is handy, however, it appears to perform some sort of HTTP post (or form submit) to the form. Since my form is wrapping everything, JQM returns me to the initial landing page – no matter where I am in the site.

Now to the question… I would like to prevent this submit from occurring and substitute some of my own logic using jQuery. I have tried the following (which does indeed fire), however, the ‘post’ or ‘submit’ continues to go though, despite returning false and preventing default. How does one intercept this event?

// Prevent form posts
$('form').live('submit', function (e) {

    // Custom logic here

    e.preventDefault(); // <-- fires, but does not prevent JQM from returning to landing page
    return false;
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:17:23+00:00Added an answer on May 27, 2026 at 3:17 pm

    Try adding data-ajax="false" to the form tag. It sounds like the jQuery Mobile Framework is still hi-jacking the submit event and running its own AJAX submission of the form.

    <form data-ajax="false"...
    

    Also you should move away from using .live(). It is depreciated as of jQuery 1.7 and if you are using jQuery 1.6 or greater then you should already be using .delegate().

    $('form').live('submit', function (e) {
    

    Changes to:

    $(document).delegate('form', 'submit', function (e) {
    

    jQuery Mobile 1.0 is packaged with jQuery Core 1.6.4 but if you move to jQuery Core 1.7 or greater then .on() is the suggested method to bind events. The above event handler declaration can be written using .on() like this:

    $(document).on('submit', 'form', function (e) {
    

    Source: http://api.jquery.com/on

    Here is a demo: http://jsfiddle.net/KAuFz/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jQuery validation plugin. On most of my input type... tags I
I'm using Freebase Suggest, a JQuery search form: <script type=text/javascript> $(function() { $(#game-search).suggest({type:'/games/game'}).bind(fb-select, function(e,
I have an input box for which I am using the Jquery autocomplete function.
Anyone know a good solution for filtering input using jQuery? I'd like to do
I would like to be able to type a search phrase into an input
I have an input box that as you type displays a div called suggestions
I'm using a placeholder span in my input fields. Using jQuery, I show/hide the
I am using jQuery and creating now search. And i want to change all
i have an input using the jquery autocomplete plugin. with this i want to
I am using jQuery UI Autocomplete plugin for better data input in my ASP.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.