user1050619 user1050619 - 7 months ago 10
HTML Question

Jquery dialog box visible by default

Im trying to test a simple dialog box using Jquery UI but somehow the dialog is visible by default.

fiddle-https://jsfiddle.net/kdh85wha/6/

HTML

<button id="callConfirm">Confirm!</button>

<div id="dialog" title="Confirmation Required">
Are you sure about this?
</div>


Javascript:

$(function() {

$("#dialog").dialog({
autoOpen: false,
modal: true,
buttons : {
"Confirm" : function() {
alert("You have confirmed!");
},
"Cancel" : function() {
$(this).dialog("close");
}
}
});

$("#callConfirm").on("click", function(e) {
e.preventDefault();
$("#dialog").dialog("open");
});

});

Answer

I changed the jquery version to 1.9 and jquery ui to 1.9 & it is perfectly working

Snapshot

jquery 1.9.1 & jquery ui 1.9.2

Working fiddle