$("document").ready(function() { var a = 3; $('#inp1').attr('oninput', '$(\'#inp2\').val(parseInt($(this).val()) + ( ',a,' * $(this).val())/100) '); }); a code that automatically transfers values from one input to another, doing some math with values. manipulations. One value must be taken from the variable 'a', since I plan to change it when I press the buttons. The question is how to do this? as I indicated, it does not work, although it is written in all sources that this is done so. thank