急急急!求助: 给按钮绑定一个对话框,将按钮上的原来事件转移到对话框的ok按钮上
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="../jquery-ui-1.10.2.custom/development-bundle/themes/base/jquery.ui.all.css">
<script type="text/javascript" src="../jquery-ui-1.10.2.custom/js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="../jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.js"></script>
<script type="text/javascript" src="../jquery-ui-1.10.2.custom/development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../jquery-ui-1.10.2.custom/development-bundle/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../jquery-ui-1.10.2.custom/development-bundle/ui/jquery.ui.dialog.js"></script>
<script>
$(function() {
$("#dialog").hide();
//怎么让下面按钮绑定的方法(该按钮还绑定了其他方法)转移到对话框的ok按钮上?前提是不复制代码到ok按钮的function中,
$(".btn").bind("click", function(){
alert("123");
});
$(".btn").click(function(){
$( "#dialog" ).dialog({
buttons: {
"ok": function(){
}
}
});
});
});
</script>
</head>
<body>
<button type="button" class="btn"> click</button>
<div id="dialog" title="Basic dialog">
<p>对话框.</p>
</div>
</body>
</html>
------解决方案--------------------不知道是不是这个意思
function fn(){
alert("123");
}
$(".btn").bind("click",
fn);
&n