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 9160269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:41:54+00:00 2026-06-17T13:41:54+00:00

I have a very simple use case on my index page. <script src=js/jquery-min.js></script> <script

  • 0

I have a very simple use case on my index page.

        <script src="js/jquery-min.js"></script>
        <script src="js/jquery-mobile.js"></script>
        <script type="text/javascript" src="cordova-2.2.0.js"></script>

         <script>
                 $("body").on("swipeleft", function(event) {
                alert('hello');
                /*window.location.href = "html/first.html";*/             
            });
       </script> 

For some reason this event is firing 2 times. Now I am sure I haven’t binded another event on the body tag as this is the first page. I have tried other simple events also like touchstart etc. They all are firing twice. What am I doing wrong ?

Update :-

I have modified the answer I marked as correct in the following way and it worked. The events on this page are not firing twice.

<head>
      <script type="text/javascript" src="js/jquery-min.js"></script>
            <script>
                 $(document).bind("mobileinit", function() {
                       $.mobile.autoInitializePage = false;
                       $.mobile.defaultPageTransition = 'none';
                       $.mobile.touchOverflowEnabled = false;
                       $.mobile.defaultDialogTransition = 'none';
                       $.mobile.loadingMessage = '' ;                 
                  });
            </script>
            <script type="text/javascript" src="js/jquery-mobile.js"></script>
            <script type="text/javascript" src="cordova-2.2.0.js"></script>
</head>
  • 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-06-17T13:41:56+00:00Added an answer on June 17, 2026 at 1:41 pm

    There are few ways of avoiding this problem. Like CodeJack told you this is a know issue but it is not an error, mainly because of the jQM unique way of handling pages.

    • Easiest one is to unbind an event before binding it again, like this:

      $("body").off().on("swipeleft", function(event) {
          alert('hello');
          /*window.location.href = "html/first.html";*/             
      });
      

      In case you have other events bound to same object use this:

      $("body").off("swipeleft").on("swipeleft", function(event) {
          alert('hello');
          /*window.location.href = "html/first.html";*/             
      });
      
    • There is an alternative to using event bind/unbind, live/die and on/off. Instead of unbinding before you bind it again use jQuery event filter, it can be used to identify if event is already been bind. Don’t forget to download it from link posted below (it is not a standard part of jQM).

      http://www.codenothing.com/archives/2009/event-filter/

      This is my usage example:

      $('#carousel div:Event(!click)').each(function(){ 
          //If click is not bind to #carousel div do something 
      });
      

      I am using each because my carousel div has many inner blocks but principle is the same. If #carousel inner div elements don’t have click event add them that event. In your case this will prevent multiple event binding.

    Additional solutions can be found here.

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

Sidebar

Related Questions

I have this very simple jQuery function: $(.milestone-in-tree).live({ mouseenter: function() { setTimeout( $.ajax({ type:
My use case is very simple : I have a GUI application, and inside
I have a very simple use case. I have an xhr object of ids
I have a very simple use case. My app lets users send invitations to
I have this very simple br2nl function that I use to take a string
I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
I have a very simple case that I think would benefit from using templates
I have a very simple macro that I use for shorthand when declaring exceptions.
I have very simple piece of code. The goal is when i input four-digit
I have very simple OpenGL ES example similar to Hehe's example : http://nehe.gamedev.net/tutorial/ios_lesson_02__first_triangle/50001/ As

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.