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

后端 未结 4 1656
暗喜
暗喜 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

    I had the same issue. The solution is pretty easy and I think the answers above may be overcomplicating a bit.

    Just use $(this).text()

    Assign a class name to the "" bit then..

    $(".yourUlClassName li a").click( function() {
        var yourText = $(this).text();
    });
    

提交回复
热议问题