I am suddenly getting this error from jQuery :
Error: cannot call methods on dialog prior to initialization; attempted to call method 'close'
Plugins
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
jQuery code
I am getting those messages in the following function:
$(document).ready(function() {
if ($('#results').html().length != 0) {
alert('has information');
$('#dialog').dialog({
modal: true,
buttons: {
Ok: function() {
// If I use $(this).dialog($(this)).dialog('close'), the UI is displayed,
// however I do not see the OK button and no errors
$(this).dialog('close');
}
}
});
} else {
alert('has no data');
}
});
HTML
<div id="dialog" title="Server Response">
<p><span class="${icon}" style="float: left; margin: 0 7px 50px 0;"></span>
<label id="results">${results}</label>
</p>
</div>
.dialog('close')
, and the error still happens. – Peter Herdenborg