Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: $(...).slider is not a function

Is there someway jquery slider dependent on server? I am using jquery library and Ui for jquery range slider. There is only one jquery library so i think no question on any conflict. The slider works perfectly fine in my linux server which gives correct output. But when i pushed the code is my IIS server i am getting this error which says TypeError: $(...).slider is not a function in mozilla browser and Uncaught TypeError: undefined is not a function in chrome browser. I am just wandering if server is anyway be the cause for it. :( Please suggest if anyone face something similar.

$(document).ready(function() {
        $("#slider").slider({
          range: "min",
          animate: true,
          value:0,
          min: 0,
          max: 30,
          step: 1,
          slide: function(event, ui) {
            update(2,ui.value); //changed
          }
      });}
like image 572
gintech Avatar asked Sep 25 '14 13:09

gintech


2 Answers

Use both Jquery and ui, then it will work.

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
like image 109
Syed Waqas Bukhary Avatar answered Nov 03 '22 16:11

Syed Waqas Bukhary


I had the same error message. In the end it turned out that my code loaded jQuery twice, including a version of jQuery that was just too old. Once I made sure that only one, recent version of jQuery was linked into my code, the error went away.

Maybe one of your servers (the IIS server) is serving up an out of date version of jQuery?

So check what version of jQuery you are using. This one works fine for me:

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js'></script>
like image 9
Jan Schnupp Avatar answered Nov 03 '22 15:11

Jan Schnupp