1

Here is the jquery for the code to open/close the dialog and the HTML links:

$("#security-code-link").click(function() {
    $("#security-code-box").dialog({ 
        draggable: false, 
        height: 500,
        modal: true,
        position: ["center","center"], 
        resizable: false, 
        width: 500
    });
});

$("#close-security-code-link").click(function() {
        $("#security-code-box").dialog("close");
});


<a id="security-code-link">Where is this?</a>
<div id="security-code-box">
<h3>Where is my security code?</h3>
<div class="center">
    <img src="<?php bloginfo("template_directory"); ?>/images/security-codes.jpg" />
    <br /><a id="close-security-code-link">Close this box</a>
</div>
</div>

Why is the dialog box not closing?

1
  • Its working for me: jsfiddle.net/G9GY8/2 using ff4, what browser are you using? Commented May 25, 2011 at 20:29

2 Answers 2

1

Try this:

$(function () {
    $("#security-code-box").dialog({ 
        draggable: false, 
        height: 500,
        modal: true,
        position: ["center","center"], 
        resizable: false, 
        width: 500,
        autoOpen: false
    });
    $("#security-code-link").live('click', function() {
       $("#security-code-box").dialog('open');
    });
    $("#close-security-code-link").live('click', function() {
       $("#security-code-box").dialog("close");
    });
});
Sign up to request clarification or add additional context in comments.

Comments

1

Works for me: http://jsfiddle.net/muF8S/1/

Make sure your script is within your ready function.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.