简体   繁体   中英

How to store dropdown selected value in a div

I have form and each and every input values I want to store in divs when it enters.

I did it for input box like this

 <input type="text" class="form-control" onkeyUp="document.getElementById('ref7').innerHTML = this.value" name="bank_name" id="bank_name" id="bank_name">

but how can I proceed it to dropdown box selected values ?

this is my select box

  <select class="select form-control" id="payment" required name="payment" onkeyUp="document.getElementById('ref14').innerHTML = this.value">
                        <option value="" disabled="disabled" selected="selected">Please select</option>
                        <option value="As per signed contract accpetable">
                            As per signed contract acceptable
                        </option>
                        <option value="As per contract not accpetable">
                            As per contract not acceptable (please specifiy the fee below)
                        </option>
                    </select>

<div id="ref14"></div>

For select instead of onkeyUp event use onchange event.

Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM