move event handler with jQuery
<p>I have an issue which is driving me crazy and as a last resort I am placing a question here.</p>

<p>I want to move the onclick event from an element to the onfocus event of the same element and I am using the following code:</p>

<pre><code>$("#theElement").bind("focus", {}, $("#theElement").data("events").click);
$("#theElement").unbind("click");
</code></pre>

<p>Maybe you have guess it. IT DOES NOT WORK.</p>

<p>How do I make this work? I am getting a "fn.apply is not a function" message in the following piece of code from jquery 1.3.2:</p>

<pre><code>proxy: function( fn, proxy ){
        proxy = proxy || function(){ return fn.apply(this, arguments); };
        // Set the guid of unique handler to the same of original handler, so it can be removed
        proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
        // So proxy can be declared as an argument
        return proxy;
    }
</code></pre>

<p><strong>EDIT:</strong> I'm sorry, I should have mentioned. This comes from a plugin which does some stuff when clicking an element. I want to make the same thing when the element gets focus not when it is cliked so the simplest solution I thought off was this since I can't modify the code for the plugin.</p>

<p><strong>EDIT:</strong> Found the problem. It is similar to what @sje397 posted in his answer, not</p>

<pre><code>$('#theElement').data('events').click[0]
</code></pre>

<p>but</p>

<pre><code>$('#theElement').data('events').click[3]
</code></pre>

<p>For some reason, even if only one event is registered the thing ends up as 3 (the guid in that piece of code from jquery).</p>
