in jQuery-UI Slider arrow keys move the slider handle (after the handle has been selected/clicked on), which is nice, but I don't want slider to handle keyboard (I use arrow keys on the page for another purpouse).
Any ideas how to disable keyboard events for jquery-ui slider?
You can unbind the keydown
event from the handle to do what you want, like this:
$("#slider").slider(); //create slider
$("#slider .ui-slider-handle").unbind('keydown'); //disable keyboard actions
You can see a demo here
You can also automate the above solution like so:
$.prototype.slider_old = $.prototype.slider;
$.prototype.slider = function()
{
var result = $.prototype.slider_old.apply(this, arguments);
this.find(".ui-slider-handle").unbind("keydown"); // disable keyboard actions
return result;
}
Just have this code run sometime before you make the "$(...).slider()" calls, and it should remove the keydown event for each one automatically, right after slider initialization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With