Live Demo
Drag the handle below; its current value is displayed live via the slide event.
Value:
jQuery UI's slider() widget turns any <div> into a draggable handle for picking a numeric value, such as a price, quantity, or volume. It supports single values, stepped increments, and even two-handle ranges — all built on top of jQuery's event handling.
| Option / Event | Description | Example |
|---|---|---|
.slider() | Turns an element into a draggable slider handle. | $('#s').slider(); |
min / max | The smallest and largest allowed values. | min: 0, max: 100 |
step | Increment the handle snaps to while dragging. | step: 5 |
value | Initial handle position (single-value slider). | value: 25 |
slide | Fires continuously while dragging; read ui.value. | slide: function(e, ui){ ... } |
range: true | Two handles for picking a min/max range. | range: true, values: [20, 80] |
ui.value (single slider) or ui.values (range slider) inside the slide callback to update a visible label as the user drags.slide Event (Live Value)
$('#slider').slider({
slide: function(e, ui){
$('#val').text(ui.value); // show the number as it drags
}
});
range: true (Two-Handle Range)
// e.g. a price-range filter
$('#priceSlider').slider({
range: true,
min: 0,
max: 1000,
values: [200, 800],
slide: function(e, ui){
$('#priceLabel').text(ui.values[0] + ' - ' + ui.values[1]);
}
});
Drag the handle below; its current value is displayed live via the slide event.
Value:
<input> if you need to submit the chosen value in a regular HTML form.