I wanna close a jquery modal dialog with a button that is within a form inside the modal...
$("#btnCancel").button().on('click', function (event) {
event.preventDefault();
$("#modalDlgWindow").dialog("close");
});
function loadDialog(tag, event, target) {
event.preventDefault();
event.stopPropagation();
var $loading = $('<img src="../../Content/assets/images/nivo-loader.gif" alt="loading" class="ui-loading-icon">');
var $url = $(tag).attr('href');
var $title = $(tag).attr('title');
$("#modalDlgWindow").empty();
$("#modalDlgWindow")
.append($loading)
.load($url)
.dialog({
autoOpen: false
, resizable: false
, autoResize: true
, title: $title
, width: 'auto'
, modal: false
, height: 'auto'
, show: 'fade'
, position: [10, 50]
, hide: 'fade'
});
$("#modalDlgWindow").dialog('open');
};
It works with .fadeOut(500)
and .empty()
and so I thought that it would also work with .dialog('close')
but it doesn't. Does anyone have a solution to my problem please?