Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery range slider event trigger

there`s a problem using the jQuery Range Slider plugin. I want to trigger an event every time the slider changed.

I don`t know on which elemt i can trigger events. For exmaple i wana have an alert message ro see if it works.

Thanks

Peter

like image 650
Peter Avatar asked Oct 31 '25 11:10

Peter


1 Answers

To get the slider value once the user has stopped moving the knob use change otherwise use input to receive updates as the knob is moved.

// Logs the value when the user has released the slider
$('.my-slider').on('change', valueUpdated);

// Logs the value while the user is moving the slider
$('.my-slider').on('input', valueUpdated);

function valueUpdated (e) {
    var val = $(e.element).val();
    console.log(val);
}
like image 117
Brandon.Blanchard Avatar answered Nov 03 '25 00:11

Brandon.Blanchard