我有我申请当文档准备好下面的代码:将jQuery代码移入一个函数?
$(document).ready(function() {
$('#updateDialog').dialog({
autoOpen: false,
width: 400,
resizable: false,
modal: true,
buttons: {
"Update": function() {
$("#update-message").html(''); //make sure there is nothing on the message before we continue
$("#updateReferenceForm").submit();
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
});
有,我可以利用这个代码的行为,并将其移动到一个函数的方式。然后,只需有我的$里面一行调用该函数(文件)。就绪(函数(){
为什么不自己尝试一下呢? – gdoron 2012-01-17 10:44:01