title: jQuery $.focus() not working with id and with input type
body: <p>I have a little problem:</p>
  
  <p>I have a modal that opens after some result search with ajax: it opens and show all requested results correctly.</p>
  
  <p>On close, I need to empty another div with ID "results", empty an input with ID "search" and focus on it:</p>
  
  <ul>
  <li>empty "results" is working</li>
  <li>changing value of "search" to "" is also working</li>
  <li>focus on "search" is not working</li>
  </ul>
  
  <p>Here's my HTML:</p>
  
  <pre><code>&lt;div class="col-sm-3"&gt;
     &lt;form action="" method="post" id="searchit"&gt;
        &lt;div class="input-group mar-btm"&gt;
           &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-search fa-lg"&gt;&lt;/i&gt; Ricerca:&lt;/span&gt;
           &lt;input type="text" id="search" tabindex="1" class="form-control" name="search" placeholder="Codice, EAN o Testo" /&gt;
         &lt;/div&gt;
     &lt;/form&gt;
   &lt;/div&gt;
   &lt;div class="col-sm-4" id="results"&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  jQuery:</p>
  
  <pre><code>$(".modal").on('hidden.bs.modal', function () {
       $("#results").empty();
       $("#search").val('');
       $("#search").focus();
  });
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>$(".modal").on('hidden.bs.modal', function () {
       $("#results").empty();
       $("#search").val('').focus();
  });
  </code></pre>
  
  <p>and (is the only text input on this page):</p>
  
  <pre><code>$(".modal").on('hidden.bs.modal', function () {
       $("#results").empty();
       $("#search").val('');
       $('input[type="text"]').focus();
  });
  </code></pre>
  
  <p>In every case, empty() and val() are working properly but nothing is working with focus()! No error thrown in console...</p>
  
  <p>I can't figure out what I'm missing/doing wrong!</p>
  
  <p>Some help? Thanks in advance!</p>