jquery – 以bootstrap3为模式回调函数

对于在bootstrap3的 javascript模式中启动一个回调函数,我有点混乱.在正常的jquery.post中,你可以这样做,
$.post('path',{ something: something },function(data) { 
  console.log(data);
});

但是在引导3模态,我通过脚本触发模态,我这样做是基于我如何理解他们的网站的解释.

$('selector').modal('show',function() { 
  //here comes the problem,I have a button in the modal in the html,my code
  //if the button was clicked inside this modal is..

  $('#myButton').on('click',function() { 
     console.log("this is a try");
  });
});

但不幸的是,如果我点击按钮,没有任何事情发生,没有任何记录在控制台.如何在一个引导模式3中调用回调函数

解决方法

对于Bootstrap 3,事件现在是命名空间,所以模态的show事件将是show.bs.modal …
$('#myModal').on('show.bs.modal',function (e) {
    alert('modal show');
});

演示:http://bootply.com/90952

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...