簡體   English   中英

jQuery-單擊事件不起作用

[英]JQuery - Click event not working

誰能發現為什么ShowVideo click事件無法觸發以使ShowVideo對話框顯示的原因? 我敢肯定,這是我所忽略的相對簡單的事情。

這是我頁面的相關代碼:

<!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提琴進行演示: http : //jsfiddle.net/Lnp9v/

您正在更改一個選項,而不是“打開”對話框:

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

更新的小提琴: http : //jsfiddle.net/Lnp9v/4/

該方法是open

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM