Reputation: 13
So, I have a link,
<a href="javascript: void(0)" id="dialog_link">I'm the link</a>
and I am trying to get a modal dialog to open up when you click the link, with an accept button, and when you click the accept button, it will forward to a new page. This is the dialog script,
<script>
$(document).ready(function() {
$('#dialog').dialog({ autoOpen: false })
$('#dialog_link').click(function(){
$( "#dialog" ).dialog('open', {
modal:true,
buttons: {
Accept: function() {
$( this ).dialog( "close" );
}
}
});
});
});
For now the accept should just close the box. The problem I am having is that is opens the dialog, but doesn't grab any of the options I specified. Anyone know how to fix it?
Upvotes: 1
Views: 11103
Reputation: 101192
No need to call dialog first:
$(document).ready(function() {
$('#dialog_link').click(function(){
$( "#dialog" ).dialog({
modal:true,
autoopen: true,
buttons: {
Accept: function() {
$( this ).dialog( "close" );
}
}
});
});
});
Upvotes: 1
Reputation: 50798
$('#dialog').dialog({ autoOpen: false })
$('#dialog_link').click(function(){
$( "#dialog" ).dialog({
modal:true,
buttons: {
Accept: function() {
$( this ).dialog( "close" );
}
}
});
$('#dialog').dialog('open');
});
Upvotes: 1