slj90 Posted March 8, 2015 Share Posted March 8, 2015 I have a textbox which is used for a price e.g $ 1.00 I want to code it so the X.XX format stays.. Firstly, I need to only allow numbers and '.' but how would I keep the format of 2 decimal place? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/295181-jquery-keep-textbox-000-2-decimal-place/ Share on other sites More sharing options...
CroNiX Posted March 8, 2015 Share Posted March 8, 2015 var num = 1; num = num.toFixed(2); //2 decimal places console.log(num); //1.00 Quote Link to comment https://forums.phpfreaks.com/topic/295181-jquery-keep-textbox-000-2-decimal-place/#findComment-1507912 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.