jquery: disable click function on ui dialog
<pre><code>$(top.document).ready(function () {   

   $("*").click(processAction);



function processAction(e){
    var clicked = e.target;
    e.stopPropagation();
    alert(clicked.tagName);
    e.stopPropagation();

    switch(clicked.tagName)
    {
        case "A":
            newDialog("You've clicked on a link !", "Please Choose An Action &lt;br&gt; 1&lt;br&gt;3");         
            return false; // prevent the default action, e.g., following a link
        break;

        case "INPUT":
            newDialog("You've clicked on a form !", "Please Choose An Action &lt;br&gt; 1&lt;br&gt;3");         
            return false;
        break;

        case "IMG":
            newDialog("You've clicked on a picture !", "Please Choose An Action &lt;br&gt; 1&lt;br&gt;3");          
            return false;
        break;

        case "BUTTON":
            newDialog("You've clicked on a button !", "Please Choose An Action &lt;br&gt; 1&lt;br&gt;3");           
            return false;
        break;

        default:
            newDialog("You've clicked on a text !", "Please Choose An Action &lt;br&gt; 1&lt;br&gt;3");         
            return false;
    }
};

function newDialog(mytitle, mycontent){
   var $dialog = $('&lt;div&gt;&lt;/div&gt;')
        .html(mycontent)
        .dialog({
            autoOpen: false,
            open: function() {$("*").unbind('click', processAction);},
            close: function() {$("*").bind('click', processAction);},
            title: mytitle,
            buttons: { "Cancel": function() { $(this).dialog("close"); } 
                     } 
        });
    $dialog.dialog('open');

}
</code></pre>

<p>I tried setting open and close events to bind and unbind the click, processAction() function, however, it doesn't seem to be working as planned.</p>
