1
引导程序模态打开时调用函数
我曾经使用过JQuery UI的对话框,它具有open选项,您可以在其中指定一些Javascript代码,以在打开对话框后执行。我会使用该选项使用我拥有的功能在对话框中选择文本。 现在,我想使用引导程序的模态来做到这一点。以下是HTMl代码: <div id="code" class="modal hide fade"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h3>Modal header</h3> </div> <div class="modal-body"> <pre> print 'Hello World' 至于打开模式的按钮: <a href="#code" data-toggle="modal" class="btn code-dialog">Display code</a> 我尝试使用按钮的onclick侦听器,但是在出现模式之前显示了警报消息: $( ".code-dialog" ).click(function(){ alert("I want this to appear after the modal has opened!"); });