title: bootstrap 4 / jquery - on click of drop down focus on input
body: <p>I am trying to focus on an input field when I click a bootstrap drop down, I can see the event firing with the alert created but the focus does not move to the search box. can anyone see why?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#devSearch").keyup(function() {
    filter = $("#devSearch").val().toUpperCase()
    div = $("#devDropdown")
    a = div.find("a")
    for (i = 0; i &lt; a.length; i++) {
      if (a[i].innerHTML.toUpperCase().indexOf(filter) &gt; -1) {
        a[i].style.display = "";
      } else {
        a[i].style.display = "none";
      }
    }
  });
  $("#devDD").click(function(){
    alert('yes')
    $('#devSearch').focus();
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet"/&gt;
  &lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/&gt;
  
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"&gt;&lt;/script&gt;
  &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"&gt;&lt;/script&gt;
  
  
  &lt;ul class="nav nav-tabs"&gt;
    &lt;li class="nav-item"&gt;
      &lt;a class="nav-link active" href="#"&gt;Active&lt;/a&gt;
    &lt;/li&gt;
    &lt;li class="nav-item dropdown"&gt;
      &lt;a class="nav-link dropdown-toggle" data-toggle="dropdown" id="devDD" href="#" role="button" aria-haspopup="true" aria-expanded="false"&gt;Devices&lt;/a&gt;
      &lt;div class="dropdown-menu dropdown-menu-fixed-height" id="devDropdown"&gt;
        &lt;input class="form-control form-control-sm" type="text" placeholder="Search..." id="devSearch" style="width:8rem; margin:0 1rem"&gt;
        &lt;a class="dropdown-item" href="#"&gt;All Entires&lt;/a&gt;
        &lt;a class="dropdown-item" href="#"&gt;Big bob&lt;/a&gt;
        &lt;a class="dropdown-item" href="#"&gt;Little bob&lt;/a&gt;
        &lt;a class="dropdown-item" href="#"&gt;Sausage&lt;/a&gt;
        &lt;a class="dropdown-item" href="#"&gt;Chicken&lt;/a&gt;
        &lt;span class="filter-results no-results"&gt;Oops, nothing found!&lt;span&gt;
      &lt;/div&gt;
    &lt;/li&gt;
  &lt;/ul&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>JS fiddle - <a href="https://jsfiddle.net/9k63htx4/36/" rel="nofollow noreferrer">https://jsfiddle.net/9k63htx4/36/</a></p>