javascript - Form submit with hidden fields -


i've got form 2 hidden fields , want , when hit submit button fill fields script before sending . form looks :

<form method = "post" action = "submit.php"> <input type="text" value="" > ... <input type"hidden" value="" > <input type"hidden" value="" >  <input type="submit" value="sendme">  <script > //do before send form </script> 

the problem ive got field @ end of form , need value of fill hidden fields calculation based on value before form submitted.

as per question, assumed want set values hidden fields based on calculation done on entered value first text-box.

you can use change method of text-box set values of hidden fields, once submit give values of fields.

<input type="text" value="" id="inputbox">  <input type="hidden" value="" id="hidden1"> <input type="hidden" value="" id="hidden2">  $('#inputbox').change(function(){    var value = $(this).val() + 10;    $('#hidden1').val(value); }; 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -