I would like to assign value of product of two integer numbers into a hidden field already in the html document.
I'm having a hard time to explain but this is how it should work:
<input type="hidden" value="[return value from product function]">
You could give your hidden field an id:
<input type="hidden" id="myField" value="" />
and then when you want to assign its value:
document.getElementById('myField').value = product(2, 3);
Make sure that you are performing this assignment after the DOM has been fully loaded, for example in the