gpt4 book ai didi

javascript - JQuery - 点击事件不起作用

转载 作者:行者123 更新时间:2023-11-28 13:37:53 25 4
gpt4 key购买 nike

任何人都可以找出为什么 ShowVideo 点击事件不会触发以显示 JQueryUI 对话框吗?我确信这是我忽略的相对简单的事情。

这是我页面的相关代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test</title>
<link rel="Stylesheet" type="text/css" href="Styles/Site.css" />
<link href='http://fonts.googleapis.com/css?family=Raleway:400,600,900' rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>


<script type="text/javascript">
$(document).ready(function () {
$(function () {
$("#dialog").dialog({ autoOpen: false }); //Hide the modal on page load.
});

$("#ShowVideo").click(function () {

$("#dialog").dialog("option", "show", "slow"); // Should show the MF'ing dialog but never gets hit!
});
});

</script>


</head>
<body>

<h2Links</h2>
<ul class="SidebarMenu">
<li id="ShowVideo">Test Popup</li>
</ul>


<div id="dialog" title="Test">

<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>



</body>
</html>

快速 JS fiddle 演示:http://jsfiddle.net/Lnp9v/

最佳答案

您正在更改选项,而不是“打开”对话框:

$("#dialog").dialog("open");

更新的 fiddle :http://jsfiddle.net/Lnp9v/4/

关于javascript - JQuery - 点击事件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20055011/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com