Mar*_*arc 5 dialog jquery-ui this
我用.data
这个来传递调用对话框的文本框的id
$("#<%=txtDirProprio.ClientID%>").focus(function()
{
$("#<%=dialog.ClientID%>").dialog( "open" ).data("id","#<%=txtDirProprio.ClientID%>");
return false;
});
Run Code Online (Sandbox Code Playgroud)
这是对话框的代码
$("#<%=dialog.ClientID%>").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
width: 800,
height:200,
modal: true,
buttons:
{
"Ajouter": function() {
$( this ).dialog( "close" );
StringBuilderDir($( this ).data("id"));
},
"Vider": function() {
$( this ).dialog( "close" );
$( $( this ).data("id") ).val("")
},
"Canceler": function() {
$( this ).dialog( "close" );
}
},
open: function()
{
var dir = $( $( this ).data("id") ).val().split("-");
if(dir[0] != "")
{
$("#<%=dd_dialog_directionvp.ClientID%> option").each(function(index)
{
if ($("#<%=dd_dialog_directionvp.ClientID()%> option")[index].text == dir[0])
{
$("#<%=dd_dialog_directionvp.ClientID()%> option")[index].selected = true;
}
})
}
}
});
Run Code Online (Sandbox Code Playgroud)
所以$ ( this ).data("id")
返回文本框的id.除了open函数外,它工作正常.id未定义
为什么它适用于按钮的功能,而不适用于打开功能.它看起来不一样'这个'
谢谢
$("#<%=txtDirProprio.ClientID%>").focus(function()
{
$("#<%=dialog.ClientID%>").data("id","#<%=txtDirProprio.ClientID%>").dialog( "open" );
return false;
});
Run Code Online (Sandbox Code Playgroud)
在呼叫之前必须先设置数据 .dialog('open');
归档时间: |
|
查看次数: |
20055 次 |
最近记录: |