i have this input fields in my html template :
<form>
<input id="id_usd_value">
<input id="id_rer_value" value="3000">
<input id="id_euros_value">
</form>
And this jquery code that it's supossed to update the usd value if i change pesos value or viceversa depending of the rer value :
<script type="text/javascript" src="jquery-2.0.3.min.js" charset="UTF-8" ></script>
<script type="text/javascript">
$(document).ready(
function() {
$('#id_usd_value').on('change',
function(e) {
$('#id_pesos_value').val(
Math.round(
parseFloat($(this).val()) / parseFloat($('#id_rer_value').val())
)
);
}
);
$('#id_pesos_value').on('change',
function(e) {
$('#id_usd_value').val(
Math.round(
parseFloat($(this).val()) * parseFloat($('#id_rer_value').val())
)
);
}
);
}
);
</script>
But it's not working, can you please help me ??
<input id="id_euros_value">vs$('#id_pesos_value')...? Is this a typo?id_pesos_value, but you reference that in your jQuery. Is<input id="id_euros_value">supposed to be<input id="id_pesos_value">? See @Yoeri's answer