You can use the javaScripts .toFixed(n) method where n
refers to the number of Decimals.
alert(10.1000.toFixed(4));
For arbitrary inputs you can try this way,
HTML :
<input type="number" id="inputTextbox" />
javaScript :
inputTextbox.onblur = function(){
ShowNumber(this.value);
};
function ShowNumber(num){
var decimalNumLength = num.split('.')[1].length;
alert(Number(num).toFixed(decimalNumLength));
}
5
solved Decimal zeros at the end are not show. Anyone help me please