get value when slider has no id property

2 posts, 0 answers
  1. Morten
    Morten avatar
    267 posts
    Member since:
    Jul 2012

    Posted 22 Apr Link to this post

    I can initialize the slider from both class and id property.

    However, I can't get the value when the slider is instantiated from class:

     

    The second console.log below produces "Cannot read property 'value' of undefined"

     

    $("#slider").kendoSlider({

      min:0,
      max:100,
      value: 10,
      smallStep: 10,
      largeStep: 50,
      showButtons: false
    });
     
    $(".slider").kendoSlider({
      min:0,
      max:100,
      value: 20,
      smallStep: 10,
      largeStep: 50,
      showButtons: false
    }); 
     
    var $sliderFromId = $("#slider").data("kendoSlider");
    console.log($sliderFromId.value());
     
    var $sliderFromClass = $(".slider").data("kendoSlider");
    console.log($sliderFromClass.value());
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 25 Apr Link to this post

    Hi,

    Selecting elements with class name will return a collection, while you need a single instance of the Kendo UI Slider, so please get a single instance and try again.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top