How to open Bootstrap dropdown programmatically

后端 未结 16 1923
轮回少年
轮回少年 2020-12-01 13:56

I\'m trying to open a Bootstrap dropdown when I click a item of another dropdown.

The idea is to select a city from the first drop down - then the script will auto o

16条回答
  •  难免孤独
    2020-12-01 14:09

    For Bootstrap 3 you can just add the 'open' class to the dropdown tag. Removing it closes the dropdown.

    $('.dropdown').addClass('open'); // Opens the dropdown
    $('.dropdown').removeClass('open'); // Closes it
    

    This may work in other versions, but I'm not sure.

提交回复
热议问题