When I click the button, it will run twice (in mobile) (jquery + phonegap)

when i use event tap

in my application it will fire more than once when i click it. I want to know how to solve it (using jquery + phonegap). In another word, can I find a way and use this way, it will fire the event only once in a small amount of time,

$('.a').live('tap',function(){...});

      

+3


source to share


1 answer


Try

$('.a').live('tap',function(e){
    e.preventDefault();
});
      

OR

$('.a').live('tap',function(e){
    e.stopPropagation();
});
      

OR

use .one .

$('.a').one('click', function() {
    // other code
});
      



OP's response.

Try using:

$('.a').live('vclick', function()
{
   console.log("works once");
)};
      

Also you can check which event is firing

$('.a').live('click tap', function(e) {
    console.log("Which Event: "+e.which + " Event Type: "+e.type);
)};
      

See jQuery mobile events for details

0


source







All Articles