JQuery unbinding a specific handler
<p>Given the code below, how can you get <code>unbind('click', h)</code> to work?</p>

<p>It doesn't currently work.  I could make <code>h</code> a global variable but I don't know how to "set this up" given the <code>msg</code> variable is set within the function.</p>

<p>??</p>

<pre><code>function x(open) {
    var msg = "blah";

    var h = function (e) {
        e.preventDefault();
        showDialog(msg);
    };

    if (open === true) {
        but.unbind('click');
        link.unbind('click');
    } else {
        but.click(h);
        link.click(h);
    }    
}
</code></pre>
