jquery模态对话框onclick? [英] jquery modal dialog onclick?
本文介绍了jquery模态对话框onclick?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要这样:
http://jqueryui.com/demos/dialog/#modal-message
在点击ClickMe时发生。
to happend when you click on ClickMe.
如何做?
<script type="text/javascript">
$(document).ready(function() {
$('div.thedialog').dialog({ autoOpen: false })
$('#thelink').click(function(){ $('div.thedialog').dialog('open'); });
}
</script>
</head>
<body>
<div id="thedialog" title="Download complete">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Your files have downloaded successfully into the My Downloads folder.
</p>
<p>
Currently using <b>36% of your storage space</b>.
</p>
</div>
<a href="#" id="thelink">Clickme</a>
发生
推荐答案
而不是 div.thedialog
,给 div#thedialog
。。
用于类名,#
被使用当你在工作时ith ids。
Instead of div.thedialog
, give div#thedialog
. the .
is used with class names and #
is used when you are working with ids.
(另外,如果这是您使用的实际代码,则有一个缺少的括号:))
( Also, if this is the actual code you used, there was a missing bracket :) )
工作代码:
<!doctype html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/ui-lightness/jquery-ui.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('div#thedialog').dialog({ autoOpen: false })
$('#thelink').click(function(){ $('div#thedialog').dialog('open'); });
})
</script>
</head>
<body>
<div id="thedialog" title="Download complete">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Your files have downloaded successfully into the My Downloads folder.
</p>
<p>
Currently using <b>36% of your storage space</b>.
</p>
</div>
<a href="#" id="thelink">Clickme</a>
</body>
这篇关于jquery模态对话框onclick?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文