This is a migrated thread and some comments may be shown as answers.

get value when slider has no id property

1 Answer 110 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Morten asked on 22 Apr 2016, 03:09 PM
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());

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 25 Apr 2016, 09:37 AM
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!
 
Tags
Slider
Asked by
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Kiril Nikolov
Telerik team
Share this question
or