I am trying to get this dialog popup form to show up when this link is clicked but it does not work for me. I've been working on this for the past three hours and this is getting too frustrating for me.
Here's my HTML:
<a href="#" id="contactUs">Contact Us</a>
<div id="dialog" title="Contact form">
<p>appear now</p>
</div>
And here's my JavaScript, this is in an external file:
$("#contactUs").click(function() {
$("#dialog").dialog("open");
return false;
});
I've used these links, but to no avail for me:
Please let me know if have an ideas, much appreciated, thanks.
You can use the following script. It worked for me
Refer:- Modal popup using jquery in asp.net
Your problem is on the call for the dialog
If you dont initialize the dialog, you don't have to pass "open" for it to show:
Also, this code needs to be on a
$(document).ready();
function or be below the elements for it to work.It's quite simple, first HTML must be added:
Then, it must be initialized:
After this you can show it by code:
Use below Code, It worked for me.
You can check this link: http://jqueryui.com/dialog/
This code should work fine
This HTML is fine:
You need to initialize the Dialog (not sure if you are doing this):