我无法从 simplemodal 中捕获 onclose 。如果可以的话请帮我一下,因为我是 jQuery 的新手...
<a href="http://url/" onclick="$(this).modal({width:833, height:453}).open(); return false;">
可以工作,但我想在模式对话框关闭时调用 javascript 函数。我如何附加,例如 updateTable();到关闭事件?
我试过
以及它的所有 Stud 变体,但老实说,查看示例页面中的嵌套函数只会让我头晕(第二个示例也有 href,但它不允许我将其发布在这里)......
I've been unable to catch the onclose from within simplemodal. please give me a hand if you can as i'm new to jQuery...
<a href="http://url/" onclick="$(this).modal({width:833, height:453}).open(); return false;">
works, but i would like to call a javascript function whenever the modal dialog is closed. How do i attach, say updateTable(); onto the close event??
I've tried
<a href="" onclick="$(this).modal({onClose: alert(1);$.modal.close();}).open();"
and all stupd variations of this, but honestly looking at the nested functions in the example page only made me dizzy (the second example also has the href, but it doesnt let me post it here)....
发布评论
评论(2)
如果我理解正确,您想要
标记的 href 中的 URL 定义的页面应该是模态内容
HTML:
JavaScript
检查 http:// jsbin.com/ofimi 获取工作示例
If I understand you correctly you want to
<a href="...">
tag should be the modals contentHTML:
JavaScript
Check http://jsbin.com/ofimi for a working sample
首先,使用 jQuery 时不必添加 onclick 属性。
假设
然后
$(this) 引用实际上指的是 a 标签,也许您可能想要使用一个名为dialog 的 div,如下所示:
并将 jQuery 更改为
UPDATE: 根据您的评论。试试这个。
First you do not have to add the onclick attribute when using jQuery.
Assume
Then
The $(this) reference actually refers to the a tag, maybe you might want to use a div called dialog like this:
and change the jQuery to
UPDATE: Based on your comment. try this.