How can I change drop down box #2 based on input from drop down box #1?

前端 未结 4 894
闹比i
闹比i 2021-01-14 17:41

I have two drop down menus.

<
4条回答
  •  死守一世寂寞
    2021-01-14 18:00

    Having a second dropdown doesn't make a lot of sense then if they're related that way, unless the user can select a combination of trailers and countries that don't match. Why not make your first control a dropdown, add a data-* attribute to the options and fill a label for the user.

    So, your options would look something like this:

    
    

    If you need the values from the second option, you can just set up a global array lookup of those country/value combinations.

    Obviously, I don't know the thoughts behind your design or what you have planned, but if the selections must match, then I don't see the point of giving the ability to select a country. It almost makes more sense to filter by your country and then hide/show options based on that selection more than what you have planned. I feel you always remove as many avenues of user interaction as you can if they aren't necessary.

提交回复
热议问题