title: How to get previous focussed element?
body: <p>How to get previous focussed element?</p>
  
  <p>Explanation:</p>
  
  <p>When user clicks phonepad keys, it should not get active or focussed.
  so that: focus or activeElement returns previous focus element (textarea or input-text) .</p>
  
  <pre><code>&lt;script&gt;
      $(function(){
          $(".phonepad").prop("disabled", true);
          $('.phonepad').mousedown(function() { preventDefault();});
          $('.phonepad input').mousedown(function() { preventDefault();});
          $('.phonepad input').click(function(){
              $(document.activeElement).sendkeys(
                         this.name || this.value);
                      );
          });
      });
  &lt;/script&gt;  
  &lt;div class="phonepad" &gt;
  &lt;input type="button" value="7" &gt;&lt;br&gt;
  &lt;input type="button" value="4" &gt;&lt;br&gt;
  &lt;/div&gt;&lt;br/&gt;
  &lt;input type="text" class="output" /&gt;&lt;br/&gt;
  &lt;textarea class="output"&gt;&lt;/textarea&gt;&lt;br/&gt;
  </code></pre>