I've a textbox control on my ASP.NET page which accepts amount of Money. If it is entered as 500,after leaving the textbox control, I want to appear it as 500.00.Using textchanged event I couldn't solve the problem in C#.Hope javascript will do it.Can anyone help me out by providing the required javascript or any other way?
You can try to do this in this fashion, make a javascript function and call it on the onblur
event of the textbox
var txt ='5'; // ur value in textbox
var decimalplace = new Number(parseFloat(txt)); // say you have values like 5.15747
alert(decimalplace.toFixed(2)); // gotta get 5.00
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.