Jquery touch event apply is not a function

0

I have a table where I drag and drop rows (drag and drop). In order to drag and drop, and also scroll the page (without dragging and dropping), I apply Jquery Touch.

The problem is when I do tap or doubletap in the table shows me an error in the console.

This is the error

jquery.js:4737 Uncaught TypeError: ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply is not a function
at HTMLTableElement.dispatch (jquery.js:4737)
at triggerCustomEvent (jquery.mobile-events.js:846)
at HTMLTableElement.tapFunc2 (jquery.mobile-events.js:498)
at HTMLTableElement.dispatch (jquery.js:4737)
at HTMLTableElement.elemData.handle (jquery.js:4549)

And this is the function

$('.touchtable').tap('tap', function(e) { 
  console.log('hola2');
});

The information that I have looked at is the following:

link

link

Any way to correct the error?

    
asked by Lluís Puig Ferrer 24.11.2017 в 11:07
source

2 answers

1

The problem is that you define the function jquery .tap() and inside you declare the type of event tap, but that does not exist as such. First you would have to declare the .on() and within declare the tap. In case you have not understood me I leave the code js:

$('.touchtable').on('tap', function(e) { 
  console.log('hola');
});
$('.touchtable').on('doubletap', function(e) { 
  console.log('hola');
});
    
answered by 24.11.2017 в 13:47
0

The code should look like this:

    $('.touchtable').on('doubletap', function(e) { 
        console.log('User tapped touchtable'); 
    }); 
    
answered by 24.11.2017 в 13:10