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

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

问题描述

我试图在单击此链接时显示此对话框弹出表单,但它对我不起作用.过去三个小时我一直在研究这个,这对我来说太令人沮丧了.

这是我的 HTML:

联系我们</a><div id="dialog" title="联系方式"><p>现在出现</p>

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

$("#contactUs").click(function() {$("#dialog").dialog("打开");返回假;});

我使用过这些链接,但对我没有用:

如果有任何想法,请告诉我,非常感谢,谢谢.

解决方案

这个 HTML 很好:

联系我们</a><div id="dialog" title="联系方式"><p>现在出现</p>

您需要初始化对话框(不确定您是否这样做):

$(function() {//这会初始化对话框(并使用我所做的一些常用选项)$("#dialog").dialog({自动打开:假,模态:真,显示:盲",隐藏:盲"});//接下来添加 onclick 处理程序$("#contactUs").click(function() {$("#dialog").dialog("打开");返回假;});});

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.

Here's my HTML:

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

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:

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

解决方案

This HTML is fine:

<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天全站免登陆