JQuery focus to previous clicked input bug
<p>I have two input fields. The main idea is that whenever you focus to one of the fields, the button click should print a random number inside it.</p>

<p>My problem is that when you just focus on (click on) the first field, then focus on second (or vice versa), the button click prints to both instead of just to the (last) focused field.</p>

<blockquote>
  <p>You can try to recreate the problem here: <a href="http://jsfiddle.net/sQd8t/3/" rel="nofollow">http://jsfiddle.net/sQd8t/3/</a></p>
</blockquote>

<p><strong>JS:</strong></p>

<pre><code>$('.family').focus(function(){

var iD = $(this).attr('id');

    $("#sets").one('click',function() {

        var ra = Math.floor((Math.random()*10)+1);

        $('#'+iD).val(ra);


    });

});
</code></pre>

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

<pre><code>&lt;center class='mid'&gt;
    &lt;input type="text" class="family" id="father" /&gt;
    &lt;br/&gt;&lt;br&gt;
    &lt;input type="text" class="family" id="mother" /&gt;

    &lt;br/&gt;
    &lt;br/&gt;
    &lt;input type='submit' value='Set text' id="sets"/&gt;
&lt;/center&gt;
</code></pre>
