html - jQuery UI Spinner - how to always display 3 decimal places -
i have decimal input presented jquery ui spinner. spinner works not display trailing 0.
i display .000 user knows how many decimal points can enter.
i have tried
$(".spinnermaxtravel").spinner({ min: 0, max: 4000, step: 0.001, numberformat: "n3" });
also set on initialize :
var num = 160.000; var c = num.tofixed(3); $('#spinner1').val(c);
this looking for, try this.
var num = 160.000; var c = num.tofixed(3); $('#spinner1').val(c+'.000'); $("#spinner1").spinner({ min: 0.000, max: 4000, step: 0.001, numberformat: "n3", stop: function (event, ui) { if ($("#spinner1").val().indexof(".") >= 0) { } else { $("#spinner1").val($(this).val() + '.000'); } } });
have fun
Comments
Post a Comment