diff --git a/src/nouislider.js b/src/nouislider.js index aab34a44..857e31a9 100644 --- a/src/nouislider.js +++ b/src/nouislider.js @@ -56,6 +56,10 @@ function init(Survey) { name: "tooltips:boolean", default: true, }, + { + name: "decimals:number", + default: 2, + }, ]); }, afterRender: function (question, el) { @@ -95,6 +99,14 @@ function init(Survey) { }, }, }, + format: { + to: function (value) { + return Number(value).toFixed(question.decimals); + }, + from: function (value) { + return Number(value).toFixed(question.decimals); + } + }, range: { min: question.rangeMin, max: question.rangeMax, @@ -121,6 +133,7 @@ function init(Survey) { el.removeAttribute("disabled"); } }; + question.value = slider.get(); }, willUnmount: function (question, el) { if (!!question.noUiSlider) {