Display Selected Item in Bootstrap Button Dropdown Title / place holder text

后端 未结 2 835
情书的邮戳
情书的邮戳 2021-02-08 21:12

This question has been asked a few times on Stackoverflow - however I still cant get to the bottom of it... plus my query is throwing more dropdowns into play. So I have two dro

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-08 21:21

    Bootstrap 4 version:

    $(".dropdown-item").click(function(){
        var selText = $(this).text();
        $(this).parents('.dropdown').find('.dropdown-toggle').html(selText+'');
    });
    

提交回复
热议问题