Search code examples
jqueryjquery-uiuisliderjquery-ui-slider

Incorrect jQuery UI slider handle, advances from 2 directly to limit


My jQuery UI handle displays the number 14 correctly when loading the page, but if I set it a second time it moves the slider handle all the way to the end. Here's the sample:

http://jsfiddle.net/rRrgV/

Surely I've done something silly, right?


Solution

  • Change:

    var v = input.val();
    

    to:

    var v = parseInt(input.val(),10);
    

    Your v variable is a string so you need to convert it to an integer.

    jsFiddle example.