How to get current slider values from JQuery Slider?

22,398

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

var val = $('#slider').slider("option", "value");
Share:
22,398
Kanishka Panamaldeniya
Author by

Kanishka Panamaldeniya

LinkedIn

Updated on January 24, 2020

Comments

  • Kanishka Panamaldeniya
    Kanishka Panamaldeniya over 4 years

    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 .

  • Kanishka Panamaldeniya
    Kanishka Panamaldeniya over 11 years
    that returns a complex object , and i already tried that one :( . is there an easy way
  • YogeshWaran
    YogeshWaran over 11 years
    @KanishkaPanamaldeniya: No,it returns integer value not complex object.
  • Kanishka Panamaldeniya
    Kanishka Panamaldeniya over 11 years
    @YogeshWaran , yes sorry i used a wrong class . now it is working , thanks guys
  • kolexinfos
    kolexinfos almost 11 years
    I am getting "Null No properties" using this syntax in my chrome debugger, why is datfor jquerymobile @Zenith