Just a simple way to create masks to your currency form fields with jQuery.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script src="jquery.maskMoney.js" type="text/javascript"></script>
<script>
$(function(){
$("#currency").maskMoney();
$("#real").maskMoney({symbol:"R$", decimal:",", thousands:"."});
$("#precision").maskMoney({precision:3})
})
function removeMask(){
$("#currency").unmaskMoney();
}
</script>
Default options are (but you can always change that):
symbol:'US$',
decimal:'.',
precision:2,
thousands:',',
allowZero:false,
allowNegative:false,
showSymbol:false,
symbolStay:false,
defaultZero:true
- Aurélio Saraiva
- Raul Pereira da Silva
- Diego Plentz
- Otávio Ribeiro Medeiros
- xtream
- Synapse Studios
jQuery-maskMoney is released under the MIT license.