I am trying to implement a jquery ui dialog box in my web app but it doesnt seem to work at all. I am using PHP.
I have a PHP code which defines the for dialog and a button which on clicked will open the dialog.
<div id="dialog">This should show up </div>
<button id="opener">Open Dialog</button>
I have a separate JS file and inside the ready function, I have the following code
$("#dialog").dialog({autoOpen:false});
$("#opener").click(function()
{
$("#dialog").dialog("open");
});
On clicking the button, the dialog doesnt seem to open up. I am using
- jquery V1.7.1
- jquery UI V 1.8.20
Can anyone help me with why it wouldn’t work.
Also, I tried setting autoOpen to true and the dialog seems to work fine on page loading but not when clicked.
Thanks for ur help
Make sure that the click code is run after the page has loaded, or it may not be able to find it and attach. I wrapped your JS code in jQuery’s .ready() to be sure.
The following example should do as you ask. If you want further assistance, I suggest you post a URL that we can look at and debug.