如何在Bootstrap 2.3.2中弹出dropup之前调用函数

How to call a function before dropup pops up in Bootstrap 2.3.2?

本文关键字:dropup 函数 调用 Bootstrap      更新时间:2023-09-26

下面是我的html:

<div class="btn-group dropup">
    <button data-toggle="dropdown" class="dropdown-toggle">
        Hi!
    </button>
    <ul class="dropdown-menu">
        <li>LI 1</li>
    </ul>
</div>

根据文件,我尝试过:

$("div.dropup").on("show", function(e) {
    alert("hey");
});

这样做正确吗?但是没有调用该函数。

有几种方法可以做到这一点

$(".dropup").on("show", function(e) {
    alert("hey");
});

此外,尝试在$(document).ready(function(){})块中绑定事件