jaridmargolin / formatter.js

Format html inputs to match a specified pattern
http://firstopinion.github.io/formatter.js
2.48k stars 235 forks source link

Doesn't work on chrome for android in Kitkat #81

Open marksalpeter opened 9 years ago

damirsel commented 8 years ago

Mobile Chrome browser and other browsers based on mobile Chrome don't recognize keypress event, so you need to put new 'input' event listener that will listen to keys pressed

inside function Formatter(el, opts) put following code:

utils.addListener(self.el, 'input', function (evt) { self._keyPress(evt); if (self.el != null) { if (self.el.createTextRange) { var range = self.el.createTextRange(); range.move('character', self.el.value.length); range.select(); } else { if(self.el.selectionStart) { self.el.focus(); self.el.setSelectionRange(self.el.value.length, self.el.value.length); } else { self.el.focus(); } } } });

GendelfLugansk commented 8 years ago

@damirsel doesn't work for me. With this code I'm unable to type on mobile completely.

CraigChaffee commented 8 years ago

Fix doesn't work for me either.

edtsz commented 7 years ago

@damirsel thanks .. it works very well for me.. (with some improvements, because the var names are different)