6
我有簡單的HTML頁面:如何打開JQuery用戶界面彈出的onclick
<html>
<head>
<title></title>
</head>
<body>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#OpenDialog").click(function() {
$("#dialog").dialog({modal: true, height: 590, width: 1005 });
});
});
</script>
<a id="#OpenDialog" href="#">Click here to open dialog</a>
<div id="dialog" title="Dialog Title">
<p>test</p>
</div>
</body>
</html>
我需要有彈出內容隱藏,當點擊鏈接打開一個對話框。
我在代碼中出錯了嗎?
謝謝!
否決權的理由? – Adil 2012-08-10 17:18:30
沒有很好的理由來降低這一個,Adil是正確的。只有在從選擇器(如jQuery或CSS)引用它時,才能將#置於實際標記的id中。在這種情況下,click處理程序永遠不會分配給元素「OpenDialog」,因爲它實際上不存在。 – mclark1129 2012-08-10 17:20:48