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, 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 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
Archived
This topic is now archived and is closed to further replies.