javascript - 除非将 html 直接输入到对话框函数中,否则无法从 jqgrid 编辑表单内部打开对话框

标签 javascript jquery html jqgrid

我尝试了各种描述“dialog-1”的方法,但没有成功。如果从那里调用对话框函数,则相同的代码作为页面主体的一部分可以正常工作。相同的代码在表单内部不起作用。

感谢您的帮助。

此函数可以很好地显示对话框。

function helpSThtml () {
$(function() {
    $( "<div id='dialog-1' title='Dialog Title goes here...'>This my first jQuery UI Dialog!</div>" ).dialog({
        height: 140,
        modal: true,
        open: function (event, ui) {
            $('.ui-dialog').css('z-index',950);
            $('.ui-widget-overlay').css('z-index',949);
        },
    });
});
}

这个函数似乎什么也没做。

function helpSTvar () {
$(function() {
    $( "#dialog-1" ).dialog({
        height: 140,
        modal: true,
        open: function (event, ui) {
            $('.ui-dialog').css('z-index',950);
            $('.ui-widget-overlay').css('z-index',949);
        },
    });
});
}

</script>

<div id="dialog-1" title="Dialog Title goes here...">This my first jQuery UI Dialog!</div>
</head>

最佳答案

看起来div标签在标题部分,它应该在正文中

<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <div id="dialog-1" title="Dialog Title goes here...">This my first
    jQuery UI Dialog!</div>

</body>
</html>

关于javascript - 除非将 html 直接输入到对话框函数中,否则无法从 jqgrid 编辑表单内部打开对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33309162/

相关文章:

javascript - 用 html 和 js 连接两个组合框

php - 你能从 PHP 循环中调用 JavaScript 函数吗?

jquery - 叠加菜单 (jQuery/CSS)

jquery - 使用导航菜单更改内容容器

javascript - 滚动更改菜单的当前元素

javascript - 从表行获取数据到 Javascript

javascript - 检查 null 的条件语句不起作用

javascript - React 中 for 循环内的异步函数

javascript - IE9 默认为 IE7,javascript 错误

html - CSS - 禁用字体 :inherit