Skip to content

Instantly share code, notes, and snippets.

@ZeusAFK
Created February 20, 2018 13:49
Show Gist options
  • Save ZeusAFK/95d982cc9a8a38107630d72041073141 to your computer and use it in GitHub Desktop.
Save ZeusAFK/95d982cc9a8a38107630d72041073141 to your computer and use it in GitHub Desktop.
<html>
<body>
<select id="currency" required="required" class="form-control">
<option value="1">Boliviano (Bs.) [ 6.96 ]</option>
<option value="2">Dolar americano ($USD) [ 6.98 ]</option>
</select>
<input id="amount" type="number" value="0.00" />
<input id="literal" type="text" value="" readonly="readonly" />
<script type="text/javascript">
var currencies = [];
currencies[1] = { plural: 'BOLIVIANOS', singular: 'BOLIVIANO', centPlural: 'CENTAVOS', centSingular: 'CENTAVO' };
currencies[2] = { plural: 'DOLARES AMERICANOS', singular: 'DOLAR AMERICANO', centPlural: 'CENTAVOS', centSingular: 'CENTAVO' };
$('#amount').keyup(function(){
update_amounts_dependencies();
});
$('#currency').change(function(){
update_amounts_dependencies();
});
function update_amounts_dependencies(){
var currency = $('#currency').val();
var amount = $('#amount').val();
$('#literal').val(numeroALetras(amount, currencies[currency]));
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment