I had this old jQuery UI slider that had worked just fine a few months ago, but now I seem to be getting an exception reading: Cannot call method \'addClass\' of undefined.
jQuery UI Slider plugin min & max options accepts only number. So according to your requirement parse them to integer or float.
For details visit link- http://api.jqueryui.com/slider/
solved the problem using unmodified jQuery-UI.min.js. Using a custom script caused the error i.e jQuery-UI-custom.js
For anyone who's still having this issue, ensure that the values you're adding (min
, max
, and values
are all NUMBERS and not STRINGS!
Been trying to diagnose a problem where the following code was failing:
t.slider({
range : true,
min : t.attr('data-min'),
max : t.attr('data-max'),
values: [t.attr('data-min'), t.attr('data-max')],
step : 1.00,
slide : function (e, ui) {
var
v = (s == 'price') ? '£' + ui.values[0] + ' - £' + ui.values[1] : ui.values[0] + ' - ' + ui.values[1] + 'kg'
$('#filter-' + s).html(v)
},
stop : function () {
Items.filter()
}
})
As t.attr()
returns a STRING, Slider was failing to set valueMouse
on line 12843 of Version 1.10.1 of jQuery UI. Instead of being a value, it was returning a string (something similar to 39.99549.21
(min value of 39.99
concatenated with 549.21
- a percentage * max value)
Hope that helps someone!
I had this issue with latest versions, too. The solution is easy: use parseInt() to pass dynamic values to sliders
Setter example for jquery ui slider:
$("#mySlider").slider("option",{min: parseInt(value.min), max:parseInt(value.max),value: parseInt(value.active)});
Another possibility - this error can come up if the min or max are missing for the slider. If your startFiling or endFiling are not evaluating to a date, the slider code fails when trying to calculate the new handle position.
For anyone reading back on this question, if you're pulling from a CDN, try pulling from the latest jQuery UI version. I also got this problem, and it was solved by using a later jQuery UI version.