title: how to write to JavaScript to focus on next input when i select bootstrap select search dropdown
body: <p>i'am trying write JavaScript that focus on next input when i select and press enter. but iam able to focus on text input on pressing enter but not able to do same on select drop down.
  is it possible or there any way to do it</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>$(document).on('keypress', 'input,select', function(e) {
  if (e.which == 13) {
  e.preventDefault();
  var $next = $('[tabIndex=' + (+this.tabIndex + 1) + ']');
  console.log($next.length);
  if (!$next.length) {
    $next = $('[tabIndex=1]');
  }
  $next.focus().click();
  }
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/js/bootstrap-select.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.js"&gt;&lt;/script&gt;
  &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.css" rel="stylesheet" /&gt;
  &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet" /&gt;
  
  
  
  &lt;select tabIndex="1" class="selectpicker" data-live-search="true"  &gt;
    &lt;option &gt;Alabama&lt;/option&gt;
    &lt;option&gt;Alaska &lt;/option&gt;
    &lt;option&gt;Arizona &lt;/option&gt;
    &lt;option&gt;Arkansas &lt;/option&gt;
    &lt;option&gt;California &lt;/option&gt;
    &lt;option&gt;Colorado &lt;/option&gt;
    &lt;option&gt;Connecticut &lt;/option&gt;
    &lt;option&gt;Delaware &lt;/option&gt;
    &lt;option&gt;Florida &lt;/option&gt;
    &lt;option&gt;Georgia &lt;/option&gt;
    &lt;option&gt;Hawaii &lt;/option&gt;
    &lt;option&gt;Idaho &lt;/option&gt;
    &lt;option&gt;Illinois Indiana &lt;/option&gt;
    &lt;option&gt;Iowa &lt;/option&gt;
    &lt;option&gt;Kansas &lt;/option&gt;
    &lt;option&gt;Kentucky &lt;/option&gt;
    &lt;option&gt;Louisiana &lt;/option&gt;
    &lt;option&gt;Maine &lt;/option&gt;
    &lt;option&gt;Maryland &lt;/option&gt;
    &lt;option&gt;Massachusetts &lt;/option&gt;
    &lt;option&gt;Michigan &lt;/option&gt;
    &lt;option&gt;Minnesota &lt;/option&gt;
    &lt;option&gt;Mississippi &lt;/option&gt;
    &lt;option&gt;Missouri &lt;/option&gt;
    &lt;option&gt;Montana Nebraska &lt;/option&gt;
    &lt;option&gt;Nevada &lt;/option&gt;
  
    
  &lt;/select&gt;
  
  &lt;br&gt;&lt;br&gt;
  &lt;input type="text" name="myname" id="myname" tabIndex="2" /&gt;
  &lt;input type="text" name="myname1" id="myname1" tabIndex="3" /&gt;</code></pre>
  </div>
  </div>
  </p>