Reputation: 2517
I am trying to open a pop up window, doing the basic thing to start with, but instead is showing me the dialog when the page loads, plus the button doesn't trigger anything.
$(document).ready(function() {
$( "#dialog" ).dialog({ autoOpen: false });
$( "#opener" ).click(function() {
$( "#dialog" ).open();
});
});
Here are my elements:
<button id="opener">open the dialog</button>
<div id="dialog" title="Dialog Title" hidden="hidden">I'm a dialog</div>
This are my imports:
<script type="text/javascript" src="scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="scripts/jquery-ui-1.11.1.js"></script>
<script type="text/javascript" src="scripts/json.debug.js"></script>
the jquery-ui-1.11.1.js contains the Core only and not Widget, Mouse and Position.
What I am doing wrong or forgetting to import?
Thanks,
Upvotes: 1
Views: 6171
Reputation: 871
From the dependencies towards the top of the dialog API page, the following are required:
and the following are optional:
If your jquery-ui-1.11.1.js contains the Core only, that would probably be why it isn't working for you.
Upvotes: 0
Reputation: 82231
For opening the dialogue on click :
$( "#opener" ).click(function() {
$('#dialog').dialog('open');
});
as you need to show this on page load, write $('#dialog').dialog('open');
in dom ready event as well.
Upvotes: 2