jQuery对话框弹出 [英] jQuery dialog popup

查看:80
本文介绍了jQuery对话框弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图让此对话框弹出式表单在单击此链接时显示,但对我不起作用.在过去的三个小时中,我一直在为此工作,这让我感到非常沮丧.

I am trying to get this dialog popup form to show up when this link is clicked but it does not work for me. I've been working on this for the past three hours and this is getting too frustrating for me.

这是我的HTML:

<a href="#" id="contactUs">Contact Us</a>
<div id="dialog" title="Contact form">
  <p>appear now</p>
</div>

这是我的JavaScript,它在一个外部文件中:

And here's my JavaScript, this is in an external file:

$("#contactUs").click(function() {
  $("#dialog").dialog("open");
  return false;
});

我使用了这些链接,但对我无济于事:

I've used these links, but to no avail for me:

  • http://jqueryui.com/demos/dialog/#modal
  • http://jqueryui.com/demos/dialog/#default

请让我知道是否有想法,非常感谢,谢谢.

Please let me know if have an ideas, much appreciated, thanks.

推荐答案

此HTML很好:

<a href="#" id="contactUs">Contact Us</a>                   
<div id="dialog" title="Contact form">
  <p>appear now</p>
</div>

您需要初始化对话框(不确定是否正在执行此操作):

You need to initialize the Dialog (not sure if you are doing this):

$(function() {
  // this initializes the dialog (and uses some common options that I do)
  $("#dialog").dialog({
    autoOpen : false, modal : true, show : "blind", hide : "blind"
  });

  // next add the onclick handler
  $("#contactUs").click(function() {
    $("#dialog").dialog("open");
    return false;
  });
});

这篇关于jQuery对话框弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆