bootstrap jquery show.bs.modal 事件不会触发 [英] bootstrap jquery show.bs.modal event won't fire

查看:24
本文介绍了bootstrap jquery show.bs.modal 事件不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 bootstrap 3 文档中的模态示例.模态有效.但是我需要在它触发时访问 show.bs.modal 事件.现在我只是在尝试:

i'm using the modal example from the bootstrap 3 docs. the modal works. however i need to access the show.bs.modal event when it fires. for now i'm just trying:

$('#myModal').on('show.bs.modal', function () {
   alert('hi')
})

没有任何反应,事件不会触发.我究竟做错了什么???这对我来说没有意义.

Nothing happens, the event does not fire. What am I doing wrong??? This doesn't make sense to me.

推荐答案

使用这个:

$(document).on('show.bs.modal','#myModal', function () {
  alert('hi');
})

这篇关于bootstrap jquery show.bs.modal 事件不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆