jQuery UI Slider IE bugfix

Do your jQuery slider brakes under IE too?

When you want to null the sliders on an page, using jQuery UI Slider, somehow the following code works in any browser except IE.

// wrong
$('.my-slider').slider('value', 0);

I say somehow, because according to the documentation this code is simply wrong. It can be used to get the value of the slider as it is a getter. You can null the value with the following snippet.

// correct
$('.my-slider').slider('option', 'value', 0);

IE Fix

Another way to null the value is with an anonymous object.

// correct
$('.my-slider').slider({ value: 0 });

This works on every browser including IE.

Leave a Reply

Your email address will not be published. Required fields are marked *