Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current slider values from JQuery Slider?

I am using jquery slider , i want to all sliders current values when one slider is changing

Slider code:

var slider = jQuery("<div class='slider'></div>").insertAfter(select)
        .slider({
            min : 0,
            max : 4,
            range : "min",
            value : select[0].selectedIndex + 1,
            slide : function(event, ui) {


            },
            change: function(event, ui) { 


            }
        });

I tried this:

        change: function(event, ui) { 

            jQuery(".minbeds").each(function(){
                alert(jQuery(this).val());
            });          
        }

but whatever the slider values, it is only alerting the value 1.

enter image description here

UPDATE:

   jQuery(".slider").slider("value"); 

will give the current slider value when change , but how can i get all slider values .

like image 242
Kanishka Panamaldeniya Avatar asked Dec 11 '25 14:12

Kanishka Panamaldeniya


1 Answers

Use the following line to access the current values of the slider:

var val = $('#slider').slider("option", "value");
like image 164
dsgriffin Avatar answered Dec 14 '25 04:12

dsgriffin