Reputation: 10611
I am using boostrap slider and this is how i am implementing it:
$("#yearSlider").slider({step: 20000, min: 0, max: 200000})
How do I get the value inside the handler rather than having it in the tool tip?
Expected result
Upvotes: 2
Views: 1098
Reputation: 168
You can set the value on the slide event in the following way:
$("#yearSlider").on("slide", function(slideEvt) {
$("#yearSlider .slider-handle").text(slideEvt.value);
});
See fiddle.
Css on the slider handle is a bit funny - it looks like its positioned absolutely, so there may be a better way to style it using the js library's options.
Upvotes: 1
Reputation: 6610
just use value property:
Example: try to run this code in console on the page you linked (http://seiyria.com/bootstrap-slider/):
document.getElementById('ex1').value
you'll see the value is returned correctly
Upvotes: 0