Saturday, 15 May 2010

cordova - when i click button, it will trigger twice(in mobile phone)(jquery+phonegap) -



cordova - when i click button, it will trigger twice(in mobile phone)(jquery+phonegap) -

when utilize tap event in application, trigger more 1 time when click it. want know how solve it(using jquery+phonegap). in word, whether find way , using way, trigger event 1 time in little time interval,

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

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 comment response.

try using:

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

also can test event firing

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

for more refer jquery mobile events

cordova jquery

No comments:

Post a Comment