I want to autofill the textbox with the amount when a dropdown is selected.. Drop down consists of first installment, second installment. When first installment is selected 1000rs has to be displayed in the textbox.. Whether it is possible to do… I want to insert option value and amount in db too
<select name="installment">
<option value="First installment">First Installment</option>
<option value="Second Installment">Second Installment</option>
</select>
<input type="text" name="amount">
2
Answers
I just added an event listener to the select, so on change the input will get the value you want depend on the value of the select.
code pen example:
https://codepen.io/Elnatan/pen/RwabKwG
to upload it to the DB i need to know what backend are you using.
but general you need to create a form (method post) or send it as a post request to the backend. then in the back end to take this value and store it to DB.
For the auto filling of amount you can try this;
Modify the HTML as follows
While Javascript is
As for the saving to Database, what language are you using?