i’ve faced the next problem:
I’m using jQuery + ajax and I want my spinner’s max and min values to be set after the data is obtained from the sever. But the real situation is that when I check the element with firebug, it says, that max and min values are set and in reality they aren’t, so there is no max and min values.
here is some code:
...
<input type="number" id ="spinId" name="someName" step="0.5" />
...
$("#spinId").attr('min', 0.0);
$("#spinId").attr('max', parseFloat($('.someClass').text()));
...
and this .someClass is formed via ajax.
also I noticed that value is set properly, i.e. $('#spinId').attr('value',ValueFromServer); works fine.
so what should I do to fix it?
The
minandmaxvalue are set when the spinner is created. To change them on the fly, use this:Also keep in mind that the
.attr()function can only be used to get and set attributes of DOM elements. For example, you can use it to get or set theidof a<div>or thehrefof an<a>element. Most jQuery plugins keep their configuration in JavaScript variables. If they do attach configuration to the DOM, they use.data().