Skip to content

Commit

Permalink
fixing mobile issues at igorescobar#348.
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Escobar committed Mar 6, 2016
1 parent df5a504 commit 050a876
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/jquery.mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,20 @@
if (el.is(':focus')) {
var range, ctrl = el.get(0);

if (ctrl.setSelectionRange) {
ctrl.setSelectionRange(pos,pos);
} else if (ctrl.createTextRange) {
range = ctrl.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
range = ctrl.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
} catch (e) {}
},
events: function() {
el
.on('input.mask keyup.mask', p.behaviour)
.on('keydown.mask', function(e) {
el.data('mask-keycode', e.keyCode || e.which);
})
.on($.jMaskGlobals.useInput ? 'input.mask' : 'keyup.mask', p.behaviour)
.on('paste.mask drop.mask', function() {
setTimeout(function() {
el.keydown().keyup();
Expand Down

0 comments on commit 050a876

Please sign in to comment.