Skip to content
This repository

$element.get(0).setSelectionRange not supported in ie (testing in ie7) #75

Closed
jdaily opened this Issue · 4 comments

4 participants

John Daily Craig Blaszczyk Michał Fijołek jdewit
John Daily

I'm getting a "Microsoft JScript runtime error: Object doesn't support this property or method" for this section of the code:

setTimeout(function() {
$element.get(0).setSelectionRange(0,2);
}, 0);
},

I'm still researching a possible fix, but any pointers would be great.

Thanks

Craig Blaszczyk

I'm also seeing this issue & would appreciate a fix!

Craig Blaszczyk

setSelectionRange is only supported in IE9+. If you have a HTML5 shim that supports it then it'll probably work fine in IE7 etc, depending on the shim. I haven't been able to find any suitable shims that work.

boostrap-timepicker should either make these calls optional, or document that the library only works with IE9+

Craig Blaszczyk

@jdewit Thanks for the quick response!

Michał Fijołek

There's still problem clicking on hour/minute field, you will get "Object doesn't support this property or method" on IE8. I've added one setSelectionRange 'if' in "widgetClick" method like this:

if ($input.is('input')) {
  if ($input.setSelectionRange) {
    $input.get(0).setSelectionRange(0,2);
  }
}

The error is gone, but it does not highlight input and its very unintuitive for the user. Is there solution to make it work on IE8?

sun16 sun16 referenced this issue from a commit in sun16/bootstrap-timepicker
sun16 sun16 #75 Add check for all setSelectionRange calls baec76b
sun16 sun16 referenced this issue from a commit in sun16/bootstrap-timepicker
sun16 sun16 #75 Add check for all setSelectionRange calls 2851200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.