JQuery Mobile: replace click event with vclick event

Is there a way to replace all click events with vclick event in jQuery mobile?

The only solution I have found so far is to register a vclick event as shown below

$('a').bind("vclick", function (ev) {
  // Do Some stuff
  ev.preventDefault();
});

The problem is that this solution does not prevent the jQuery event from being triggered for mobile devices, so clicks are fired twice

+5
source share
2 answers

For some reason, I got the following:

$('a').bind('vclick click',function(e){
  e.preventDefault();
   //do some stuff//
 })

Without e.preventDefault (), the event fires twice. However, it only fires once (but it fires)

This is similar to what you stated, but could be more comprehensive.

+4
source
$("#elementId").bind('vclick',function(event){
event.preventDefault();
 //your code..
});

works fine.

+2
source

All Articles