Selecting an option from one drop down populates other input fields

前端 未结 2 453
青春惊慌失措
青春惊慌失措 2021-01-24 08:12

I am trying to figure out how to populate other tags with a specific text after selecting from a drop down.

So if the drop down and another drop down below it the foll

相关标签:
2条回答
  • 2021-01-24 08:12

    Here is another option, scaled down from some development I've done. A bit more flexible but also more complex. Pay attention to how the items are tagged with data-* attributes to decide what is hidden and shown. http://jsbin.com/siyexumulu/1/

    0 讨论(0)
  • 2021-01-24 08:19

    For predefined values like what you have, you can use the following jQuery/JavaScript code:

    $(function() {
        $('#dropDown1').change(function(){
           $('#dropDown2').val('You chose ' + this.value);
        });
    });
    

    JS Fiddle here: http://jsfiddle.net/vleong2332/82w7p0a6/

    Here is the example to change dropDown1 when dropDown2 changes. http://jsfiddle.net/vleong2332/82w7p0a6/1/

    0 讨论(0)
提交回复
热议问题