I'm trying to create a dialog (on click) for feedback. I've tried simple things first. Here's the fiddle

我正在尝试创建一个对话框(点击)以获得反馈。我先尝试过简单的事情。这是小提琴

$("#feed_win").dialog({
    autoOpen:false;
});


$("#feedback").click( function() {
    $( "#feed_win" ).dialog( "open" ); 
});

But every time on load the dialog contains are shown before the button click event. Any help will be useful.

但每次加载时,对话框都包含在按钮单击事件之前。任何帮助都会有用。

So, now i tried this.

所以,现在我尝试了这个。

<head>
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

    <script type="text/javascript">

    $("#feedback").button().click(function() {
          $("#feed_win").dialog("open");
        });

        $("#feed_win").dialog({
        autoOpen: false,
        modal: true,
        height: 300,
        width: 400
    });
    </script>
    </head>
    <body>
    <button id="feedback">Delete profile</button>

          <div id="feed_win">
            <h2>This is feedback form</h2>
            <p>You can add your feedback here</p>
        </div>
    </body>

But the dialog div is displayed on page load. why? It should be displayed after clicking button.

但是对话框div显示在页面加载上。为什么?单击按钮后应显示。

1 个解决方案

#1


2

You need to include jQuery UI script in the head:

您需要在头部包含jQuery UI脚本:

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

Here is fiddle: DEMO

这是小提琴:DEMO

Everything else you wrote is good, just add that line

你写的其他所有内容都很好,只需添加该行即可

更多相关文章

  1. 开发学习Jquery实例---双击表格弹出模态对话框,编辑提交数据
  2. bootstrap,模态对话框,shown.bs.modal事件不会触发
  3. 当AJAX响应来自PHP文件时,如何显示以消息为中心的加载器图像&防止
  4. 为什么使用observe_field代码不能使用JQuery模型对话框?
  5. jQuery UI对话框调整大小关闭按钮
  6. 最简单jquery.ajax+php例子(对话框显示文本框输入内容),以小见大
  7. 打开后,JQuery ui对话框调整大小
  8. 使用jQuery确认对话框防止上的表单回发
  9. 我得到一个警告坏js小提琴配置

随机推荐

  1. shape .xml
  2. 安装Intel HAXM为Android 模拟器加速,30秒
  3. google Android 认证测试
  4. 2、创建android应用程序
  5. Ubuntu下连接Android设备
  6. android PhoneGap 的入门例子
  7. android 最全的shape属性
  8. Android(安卓)之 Context Menu 上下文菜
  9. 开发Android第四步,Android NDK 及 androi
  10. 向android studio导入android源生app