Jquery spinner initial value not getting set

jquery, jquery-ui, spinner

Solution

I don't know why the value option isn't working as documented. I've tried it myself and have the same problem. This will solve your issue though...

function setSpinner(spinnerid, minval, maxval, initvalue) {
    $("#" + spinnerid).spinner({ min: minval, max: maxval }).val(initvalue);
}

I just added the `val()` at the end to set the initial value. (I also added a function name, just because you missed it in your question. Call it what you need.)

Problem

I am using JQuery spinner control on my web form. But it's initial value is not getting set. I am using IE9 + VS2010 Here is the code I have written in my common function. I call this function at run time and send parameters accordingly. ``` function(spinnerid, minval, maxval, initvalue, step) { $("#" + spinnerid).spinner({ min: minval, max: maxval, increment: step, value: initvalue }); } ``` These are the libraries I use: ``` <script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script> <link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" /> ``` And this is the HTML code: ``` <input type="text" id="income" class="income" /> ```

Original source