jquery - triggering a click event when an image gets focus
<p>I have a <code>div</code> element to which I am dynamically generating an input field and an image besides it. When I click on the input field and then use the tab key, the image gets the focus.</p>

<p><strong>What I want to do</strong></p>

<p>When the image has the focus, I want to trigger an enter key event.</p>

<p><strong>HTML</strong> </p>

<pre><code>&lt;div id="myDiv"&gt;&lt;/div&gt;
</code></pre>

<p><strong>JQuery</strong></p>

<pre><code>$(document).ready(function(){
     $("div#myDiv").html("&lt;input type='text' tabindex='1'&gt;&lt;/input&gt;&lt;a&gt;&lt;img src='icon.gif' tabindex='2'&gt;&lt;/img&gt;&lt;/a&gt;");
});
</code></pre>
