I have this div in my master page.
<div id="UICancelChanges" title="Are you sure?" style="display: none;">
开发者_StackOverflow Your changes have not been saved. Are you sure you want to CANCEL ?
</div>
On click I am just opening Jquery dialog popup window..
CancelEdit = function (accountId) {
$("#UICancelChanges").dialog({
resizable: true,
height: 140,
width: 500,
modal: true,
buttons: {
"Yes": function () {
$(this).dialog("close");
},
"No": function () {
$(this).dialog("close");
}
}
});
return false;
};
Is there any way that I can change the Title of this Div popup dynamically? using same code I need to change the title dynamically?
How to open my popup window in the controller code?something like this?
return new JavaScriptResult() { Script = "alert('SubCategory Successfully Added. Thank You.'); window.location='/ObnCategory/Index';" };
Instead of alert i need to open the popup window.
Thanks
call this before you display the dialog
initialise:
$( "#UICancelChanges" ).dialog({ title: 'Dialog Title' });
to set the new title do
$( "#UICancelChanges" ).dialog( "option", "title", 'New Dialog Title' );
to get the title
var title = $( "#UICancelChanges" ).dialog( "option", "title" );
for more help on the properties visit http://jqueryui.com/demos/dialog/#option-title
Per the jQuery UI website documentation:
$( ".selector" ).dialog( "option", "title", 'Dialog Title' );
you can use this:
$("span.ui-dialog-title").text(anything);
精彩评论