Twitter Bootstrap: How do I get the selected value of dropdown?

后端 未结 4 1662
暗喜
暗喜 2021-02-05 16:33

I need to get the value a user selects from a twitter bootstrap dropdown. Once the user selects a value I want the dropdown to display that value. So, the user selects \'pending

4条回答
  •  臣服心动
    2021-02-05 16:52

    Bootstrap provides you with minimum required functionality for your implementation, they aren't dropdowns instead they are mere ul, li's with css applied on it and some events registered in the bootstrap plugin for toggling the button to display them as dropdown. This one you need to do on your own.

    Set up some identifier to the status button say a className btnStatus and bind a click event to the dropdown links. and do something like this?

    $('.dropdown-inverse li > a').click(function(e){
        $('.btnStatus').text(this.innerHTML);
    });
    

    Demo

提交回复
热议问题