Skip to content

Commit cde6bca

Browse files
committed
Fixing caret position on focus.
1 parent 36243cb commit cde6bca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/jquery.maskedinput.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
FixedWidthMask.prototype.apply = function(input, caretPosition){
9595
if(caretPosition == null)
96-
caretPosition = 0;
96+
caretPosition = this.length;
9797
var buffer=[],
9898
raw=[],
9999
lastMatch = -1,
@@ -200,7 +200,7 @@
200200
focusText = elm.value;
201201

202202
function blurEvent(e) {
203-
var result = mask.apply(elm.value, 0);
203+
var result = mask.apply(elm.value);
204204
elm.value = result.trimmed;
205205
if(settings.autoclear && !result.isComplete){
206206
elm.value = "";
@@ -279,7 +279,7 @@
279279
var caretTimeoutId;
280280
function focusEvent(e){
281281
clearTimeout(caretTimeoutId);
282-
var result = mask.apply(elm.value, 0);
282+
var result = mask.apply(elm.value);
283283
focusText = elm.value;
284284

285285
caretTimeoutId = setTimeout(function(){
@@ -323,7 +323,7 @@
323323

324324
//Apply initital mask
325325
if(elm.value.length){
326-
var result=mask.apply(elm.value, 0);
326+
var result=mask.apply(elm.value);
327327
elm.value = result.value;
328328
}
329329
});

0 commit comments

Comments
 (0)