Created
February 20, 2018 13:49
-
-
Save ZeusAFK/95d982cc9a8a38107630d72041073141 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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