Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery.ui.touch.punch.js script is preventing input functionality on touch devices

It took me a little bit, but I figured out that I can't click on my inputs because of the touch.punch script I'm using to enable jquery UI drag functionality on touch devices. Anyone familiar with this script know why that might be? The form actually resides down the tree of the parent object. Does anyone know a way I can override or force through the selection? I'm going to try binding events that force focus to the input right now but maybe someone here has some insight?

like image 511
Throttlehead Avatar asked Sep 21 '12 22:09

Throttlehead


1 Answers

JEditable + jQuery UI Sortable + jquery.ui.touch-punch

I have spent all day on this problem and I finally figured out the solution. The solution is very similar to kidwon's answer. However, I was using jeditable which dynamically creates input fields without class names. So I used this conditional statement instead of checking the class name:

//Check if element is an input or a textarea
if ($(touch.target).is("input") || $(touch.target).is("textarea")) {
  event.stopPropagation();
} else {
  event.preventDefault();
}

I think this is a better solution as it always uses the native functionality for any input or textarea fields.

like image 183
Danwilliger Avatar answered Oct 27 '22 11:10

Danwilliger