I need help applying onFocus attribute to all elements of a class
<p>My goal is to apply onFocus = "if(this.blur)this.blur()"; to all the area sections under an image map for a Microsoft Chart Control being dynamically created on the page.</p>

<p>Below, I go into IE and edited the 'attributes' field. This is achieving my desired goal, but I can't seem to get it in javascript.</p>

<p>I thought it should be this:</p>

<pre><code>$(".area").onFocus(
    function () {
        if ($(this).blur) $(this).blur();
    }
)
</code></pre>

<p>but I do not see the same results when using this script. Any thoughts?</p>

<p>Cheers</p>

<p>EDIT:</p>

<p>I am now using the code:</p>

<pre><code>$(".area").focus(
    function () {
        if ($(this).blur) $(this).blur();
    }
)
</code></pre>

<p>but this does not seem to replicate the same functionality as editing the attribute directly. Does anyone have an idea as to why? I can try using a more broad css selector, but as far as I can tell.. this should work!</p>

<p><img src="http://i.stack.imgur.com/JatOY.png" alt="enter image description here"></p>
