我想設置一個對話框,我希望將按鈕的名稱按下並轉移到對話框中,但我不知道如何執行此操作。在jQuery中傳遞變量以更改對話框標題
到目前爲止,我有:
$(document).ready(function(){
$("#x").live('click', function(){
var name = $(this).attr('name'); //want to pass this to the next jquery
$('#dialog_box').dialog("open");
});
var input = $("#input");
$("#dialog_box").dialog({
autoOpen: false,
resizable: false,
height:180,
width: 350,
modal: true,
buttons: {
"Update": function(){
alert(name);
}
}
});
});
另外,我將如何去使用變量,一旦轉移到更新的對話框(如下標記)的稱號?
<div id="dialog_box" title="name variable here">
<form id="dialog_form" name="dialog_form">
<fieldset>
<input type="text" name="input" id="input"/>
</fieldset>
</form>
</div>
任何幫助表示讚賞:)
謝謝,我肯定會考慮將來更多地使用data()方法。每天都是學校的一天:) – xgstr 2013-03-14 14:40:13