Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 除非html直接输入到对话框函数中,否则无法从jqgrid编辑表单内部打开对话框_Javascript_Jquery_Html_Jqgrid - Fatal编程技术网

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

Javascript 除非html直接输入到对话框函数中,否则无法从jqgrid编辑表单内部打开对话框,javascript,jquery,html,jqgrid,Javascript,Jquery,Html,Jqgrid,我尝试过各种描述“对话1”的方式,但都没有成功。如果从页面主体调用对话框函数,则相同的代码可以作为页面主体的一部分正常工作。相同的代码在表单内部不起作用 谢谢你的帮助 此函数可以很好地显示对话框 function helpSThtml () { $(function() { $( "<div id='dialog-1' title='Dialog Title goes here...'>This my first jQuery UI Dialog!</div>"

我尝试过各种描述“对话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);
        },
    });
});
}
函数helpSThtml(){
$(函数(){
$(“这是我的第一个jQuery UI对话框!”)。对话框({
身高:140,
莫代尔:是的,
打开:功能(事件、用户界面){
$('.ui dialog').css('z-index',950);
$('.ui小部件覆盖').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>
函数helpSTvar(){
$(函数(){
$(“#dialog-1”).dialog({
身高:140,
莫代尔:是的,
打开:功能(事件、用户界面){
$('.ui dialog').css('z-index',950);
$('.ui小部件覆盖').css('z-index',949);
},
});
});
}
这是我的第一个jQueryUI对话框!

似乎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>

这是我的第一次
jQueryUI对话框!
试试看

  • 您的
    需要位于
    内部,而不是

  • 在每个函数中都包含
    $(function(){
    ,这不是一个好做法,相反,您应该这样做:

    function helpSTvar () {
        $( "#dialog-1" ).dialog({
            height: 140,
            modal: true,
            open: function (event, ui) {
                $('.ui-dialog').css('z-index',950);
                $('.ui-widget-overlay').css('z-index',949);
            },
        });
    }
    
    $(function(){
        helpSTvar(); // call one or more functions when document's ready
    });
    

  • 谢谢你,Jhonatan。我对JQuery和Javascript也不熟悉。“$(function()”怎么样调用?我在代码中没有看到任何明显的联系。我知道它可以工作,但我对实例化它的机制很好奇。JQuery中有很多不可见的移动部分,这使得从表面上学习很困难。再次感谢。不客气。“$(function(){”是“$(document)的别名。ready(function(){”…因此,您的浏览器知道,当文档完全加载时,它内部的所有内容都必须以程序化的方式执行。Javascript是程序化的,因此函数外部的所有内容都必须以程序化的方式执行。谢谢Sudipta。这也不起作用。我是从那里开始的。我唯一能够开始工作的是嵌入直接在.dialog()函数中创建html。