SOURCE

console 命令行工具 X clear

                    
>
console
// $(".dropdown-item").click(function () {
//   $("button").text($(this).text());
// });

var select1 = $("#select_1").text();
if (select1!='') {
    $("#select1").text(select1)
};

var select2 = $("#select_1_1").text();
if (select2!='') {
    $("#select2").text(select2)
};

var select3 = $("#select_1_1_3").text();
if (select3!='') {
    $("#select3").text(select3)
};
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="select1" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown button
  </button>
  <ul class="dropdown-menu" aria-labelledby="select1">
    <li><a id="select_1" class="dropdown-item active" href="#">Action</a></li>
    <li><a id="select_2" class="dropdown-item" href="#">Another action</a></li>
    <li><a id="select_3" class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</div>

<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="select2" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown button
  </button>
  <ul class="dropdown-menu" aria-labelledby="select2">
    <li><a id="select_1_1" class="dropdown-item active" href="#">Action</a></li>
    <li><a id="select_1_2" class="dropdown-item" href="#">Another action</a></li>
    <li><a id="select_1_3" class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</div>

<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="select3" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown button
  </button>
  <ul class="dropdown-menu" aria-labelledby="select3">
    <li><a id="select_1_1_1" class="dropdown-item active" href="#">Action</a></li>
    <li><a id="select_1_1_2" class="dropdown-item" href="#">Another action</a></li>
    <li><a id="select_1_1_3" class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</div>

本项目引用的自定义外部资源