2016-08-03 60 views

回答

5

事情是這樣的:

onblur="this.value=parseFloat(this.value).toFixed(2);" 

<input placeholder="Amount" onblur="this.value=parseFloat(this.value).toFixed(2);" >

0

在腳本文件

document.querySelector('input[name="AmountPaying"]').addEventListener('blur', function() { 
    this.value = parseFloat(this.value).toFixed(2); 
});