Skip to content

Commit c5d8f1b

Browse files
author
SamWM
committed
Merge pull request SamWM#72 from damintsew/fix_ie
Fix ie
2 parents 9fb40af + 3d90fc6 commit c5d8f1b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

numeric/jquery.numeric.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,17 @@ $.fn.getSelectionStart = function(o)
247247
{
248248
if (o.createTextRange)
249249
{
250-
var r = document.selection.createRange().duplicate();
251-
r.moveEnd('character', o.value.length);
252-
if (r.text === '') { return o.value.length; }
250+
var r;
251+
if(typeof document.selection == "undefined") {
252+
//On IE < 9 && IE >= 11 : "document.selection" is deprecated and you should use "document.getSelection()"
253+
//https://github.com/SamWM/jQuery-Plugins/issues/62
254+
r = document.getSelection();
255+
} else {
256+
r = document.selection.createRange().duplicate();
257+
r.moveEnd('character', o.value.length);
258+
}
259+
if (r.text == '') return o.value.length;
260+
253261
return o.value.lastIndexOf(r.text);
254262
} else { return o.selectionStart; }
255263
};

0 commit comments

Comments
 (0)