Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI slider - Cannot call method 'addClass' of undefined

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. I've checked the values being passed into the slider and they're regular Javascript dates.

  $('#dateFilter').click(function() {
    return $('#sliderContainer').slideToggle(200);
  });

  $(function() {
    var endFiling, startFiling;
    startFiling = Date.parse($('#startFiling').val());
    endFiling = Date.parse($('#endFiling').val());
    return $('#filingDateSlider').slider({
      range: true,
      min: startFiling,
      max: endFiling,
      step: 86400000,
      values: [startFiling, endFiling],
      slide: function(event, ui) {
        var eD, end, sD, start;
        sD = new Date(ui.values[0]);
        start = dateFormat(sD);
        eD = new Date(ui.values[1]);
        end = dateFormat(eD);
        $('#filingStartDate').text(start);
        return $('#filingEndDate').text(end);
      }
        });

Is there a particular reason why I might be getting this new error?

http://i.imgur.com/xC2E6.jpg

like image 995
SCS Avatar asked Jul 30 '12 19:07

SCS


2 Answers

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.

like image 79
Vinay Avatar answered Sep 21 '22 20:09

Vinay


I solved this error by using integers in "min", "max" and "values". Maybe you are setting null values.

The jQuery Slider specification says:

  • max Number Default:100
  • min Number Default:0
  • value Number Default: 0

So "values" are an array of numbers.

like image 24
Miguel Gil Martínez Avatar answered Sep 22 '22 20:09

Miguel Gil Martínez