Pass a javascript variable value into input type hidden value code example
Example: javascript change hidden input value
document.getElementById("myHiddenInputID").value = "MyNewValue";
document.getElementById("myHiddenInputID").value = "MyNewValue";