javascript - Avoid decimal values in dijit/form/HorizontalSlider -


in dijit/form/horizontalslider on change getting values in textbox. values decimal, 51.66777777. want 51.

<div id="horizontalslider"></div> <input type="text" id="slidervalue" data-dojo-type="dijit.form.textbox" style="width:190px;" onkeyup="getslidertxtboxvalue();">  var slider = new horizontalslider({                     name: "horizontalslider",                     value: 1,                     minimum: 1,                     maximum: 500,                     discretevalues: 10,                     intermediatechanges: true,                     style: "width:200px;",                     onchange: function(value){                         dom.byid("slidervalue").value = value;                     }                 }, "horizontalslider"); 

see also:

http://dojotoolkit.org/reference-guide/1.8/dijit/form/horizontalslider.html

have ever seen spinal tap? 1 goes 11!

here code work:

value: 0, minimum: 0, maximum: 500, discretevalues: 11, 

you want 11 because want 11 discrete values:

0,50,100,150,200,250,300,350,400,450,500

i created fiddle problem.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -