$(document).ready(function () { console.log(max_theorique); $('#id_theoretical_max_percentage').change(function(event) { console.log(event); var proposed_weight = max_theorique / 100 * Number($('#id_theoretical_max_percentage').val()); $('#id_chosen_weight').val(proposed_weight); }) });