Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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 Jquery模式无法正常工作_Javascript_Jquery_Jquery Ui_Jquery Ui Dialog - Fatal编程技术网

Javascript Jquery模式无法正常工作

Javascript Jquery模式无法正常工作,javascript,jquery,jquery-ui,jquery-ui-dialog,Javascript,Jquery,Jquery Ui,Jquery Ui Dialog,我试图使用jquery ui模式,但它不能满足我的需要,也就是说,我只想在模式中显示数据,但在这里,它会在我单击按钮之前显示出来 函数弹出窗口 { 变量对话框,窗体 dialog=$'divinfoDialog'。dialog{ 自动打开:错误, 身高:600, 宽度:500, 莫代尔:对 }; $'showInfos'。单击函数E{ e、 防止违约; 对话框。对话框‘打开’; }; } 测验 Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行

我试图使用jquery ui模式,但它不能满足我的需要,也就是说,我只想在模式中显示数据,但在这里,它会在我单击按钮之前显示出来

函数弹出窗口 { 变量对话框,窗体 dialog=$'divinfoDialog'。dialog{ 自动打开:错误, 身高:600, 宽度:500, 莫代尔:对 }; $'showInfos'。单击函数E{ e、 防止违约; 对话框。对话框‘打开’; }; } 测验 Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一位不知名的印刷商拿起一个打印工具,将其拼凑成一本打印样本书。它不仅存活了五个世纪,而且还跨越到电子排版,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着包括Lorem Ipsum版本的Aldus PageMaker等桌面出版软件的发布而流行


最好使用DOM ready事件在页面加载时设置一次模式: 更多信息:

您的html现在变为,注意按钮上没有onclick=

<button type="button" id="showInfos">test</button>
    <div id="infoDialog" title="Eventinfos">
      <p>
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
      </p>
    </div>

Fiddle:

您的代码几乎是正确的,您的代码中只有一个错误,那就是您将所有javascript代码绑定到onclick事件,这就是它默认显示模式内容的原因。 因此,现在只需删除onclick事件和弹出函数。因此,您的最终代码如下所示

测验 Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一位不知名的印刷商拿起一个打印工具,将其拼凑成一本打印样本书。它不仅存活了五个世纪,而且还跨越到电子排版,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着包括Lorem Ipsum版本的Aldus PageMaker等桌面出版软件的发布而流行

//函数弹出窗口 // { 变量对话框,窗体 dialog=$'divinfoDialog'。dialog{ 自动打开:错误, 身高:600, 宽度:500, 莫代尔:对 }; $'showInfos'。单击函数E{ e、 防止违约; 对话框。对话框‘打开’; }; // }
autoOpen:true,是否应为:autoOpen:false?否则它将在加载后立即打开。无更改。同样的问题
<button type="button" id="showInfos">test</button>
    <div id="infoDialog" title="Eventinfos">
      <p>
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
      </p>
    </div>