简体   繁体   中英

On Select Event Another drop down appears

is it possible to create below scenario using Javascript:

I have a drop down box "Deposit Type" which has 2 options: "Envelop" and "Enhanced". and what i want is when I select Envelop from drop down list another check box should appear as "Dispensing".

<select id="DepositType" name="nmf" style="float:left;">
    <option value="Envelope">Principal</option>
    <option value="Enhanced">Producer</option>
</select>
$('select#DepositType').on('change', function() {
  if ($(this).val() == 'Envelope') {
  //do something
  }
});

Updated fiddle http://jsfiddle.net/PV52L/

document.getElementById("DepositType").onchange = function(event) {
if (event.target.value == "Envelope")
    document.body.innerHTML += '<input type="checkbox" name="Dispensing" value="Dispensing">Dispensing<br>';
};

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