jQuery弹出窗口不能打开。
16lz
2021-01-22
i have implemented a jquery pop up
我已经实现了一个jquery弹出。
as
作为
<script type="text/javascript">
$(document).ready(function () {
$("input[id$=btnclick]").click(function () {
if ($("#content").html() != "") {
AlertDialog($("#content").html());
}
});
});
function AlertDialog(msg) {
$.modaldialog.success(msg, {
width: 400,
height: 100
});
}
// $(document).ready(function () {
// if ($("#content").html() != "") {
// AlertDialog($("#content").html());
// }
// });
</script>
<asp:Button ID="btnclick" runat="server" Text="click me" />
on document.getready the popup open correctly but on click the pop up doesn't open.Thanks for assistance
在文档。正确地打开弹出窗口,但是点击弹出窗口不会打开。谢谢你的帮助
3 个解决方案
#1
2
I see that you place the click on an input, inputs make post back, probably you need to prevent that using the e.preventDefault();
as:
我看到你点击了一个输入,输入后返回,可能你需要阻止使用。preventdefault ();为:
$(document).ready(function () {
$("input[id$=btnclick]").click(function (e)
{
if ($("#content").html() != "") {
// here prevent from post back
e.preventDefault();
AlertDialog($("#content").html());
}
});
});
And a test: http://jsfiddle.net/TwFX5/2/
和一个测试:http://jsfiddle.net/TwFX5/2/
更多相关文章
- jQuery 1.3 API 参考文档中文版
- [置顶] JQuery datatables 使用Fixedcolumns固定列控件
- jQuery Ui Draggable在移动端浏览器不起作用解决方案
- day049--jQuery文档操作示例
- 如何使用CSS在HTML文档中插入换行符
- Jsoup对html文档的解析
- Python脚本利用openoffice将office文档转为html或者pdf。
- 韩顺平_轻松搞定网页设计(html+css+javascript)_第19讲_js运行原
- html2canvas 识别 svg 解决方案