JQTouch - Can't insert input field: has anyone seen this?

Here is the HTML snippet:

<input type="text" name="UPCtext" id="UPCtextBar" value="" placeholder="Type UPC number" class="UPCvalue"/> 

There are no bind () or live () events associated with this input field.

If I remove jQTouch, does it work as it should, so that anyone can handle this problem?

+4
source share
2 answers

A quick search for "jqtouch paste" revealed a jqTouch issue , which suggests that it might be a WebKit inheritance error. No solution is proposed at this stage.

+1
source

I found a workaround:

 function fixCopyPaste(el) { el.bind('paste', function(e) { var element = $(this).context; var text = $(this).val(); var start = element.selectionStart; var pastedText = e.originalEvent.clipboardData.getData('text/plain'); $(this).val(text.substring(0, element.selectionStart) +pastedText +text.substring(element.selectionEnd, text.length)); element.selectionStart = start+pastedText.length; element.selectionEnd = element.selectionStart; }); } 

Call this function on the input element that you want to enable. For instance:.

 fixCopyPaste($('#notes')); 

Perhaps it can be expanded to handle multiple items.

0
source

Source: https://habr.com/ru/post/1300089/


All Articles