我想设置一个对话框,我希望将按钮的名称按下并转移到对话框中,但我不知道如何执行此操作。在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