Reputation: 10412
I want to put a decimal mask on a textbox. I want the for mat to be 999.99999 (three digits to the left of the '.' and 5 to the right.
I want to allow the negative sign '-' at the start
so we can input -245.45218 for example I tried using this:
$("#latitude").decimalMask("999.99999");
But this does not allow the '-' sign to be placed at the begining
I also tried
$("#latitude").decimalMask("#999.99999");
But it is not working.
Any help is greatly appreciated
Upvotes: 0
Views: 6116
Reputation: 18339
This plugin allows you to create your own mask element.. https://github.com/digitalBush/jquery.maskedinput
$.mask.definitions['~']='[-]?';
$("#latitude").mask("~999.99999");
jsfiddle: http://jsfiddle.net/lucuma/MKKWd/
Upvotes: 1