title: Check if select is displaying options
body: <p>I have the following HTML code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select&gt;
  &lt;option selected&gt;Test 1&lt;/option&gt;
  &lt;option&gt;Test 2&lt;/option&gt;
  &lt;option&gt;Test 3&lt;/option&gt;
  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do I check if the <code>&lt;option&gt;</code>s of the <code>&lt;select&gt;</code> are displayed? For example, this is considered as the <code>&lt;option&gt;</code>s of the <code>&lt;select&gt;</code> are displayed:</p>
  
  <p><img src="https://i.stack.imgur.com/UvWJh.png" alt="Options of the select menu are displayed"></p>
  
  <p>And this is considered that the <code>&lt;option&gt;</code>s of the <code>&lt;select&gt;</code> are not displayed:</p>
  
  <p><img src="https://i.stack.imgur.com/VmbnE.png" alt="Options of the select menu are not displayed"></p>
  
  <hr>
  
  <p>I have tried this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#myselect").on("click", function() {
      if ($("#myselect option").length == 0) {
          console.log("not displayed");
      } else {
          console.log("displayed");
      } 
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;select id="myselect"&gt;
  &lt;option selected&gt;Test 1&lt;/option&gt;
  &lt;option&gt;Test 2&lt;/option&gt;
  &lt;option&gt;Test 3&lt;/option&gt;
  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But the console logs "displayed" all the time.</p>
  
  <hr>
  
  <p>So how can I achieve this?</p>
  
  <hr>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>The answers at <a href="https://stackoverflow.com/questions/11123746/how-to-check-if-an-select-element-is-still-open-active-with-jquery">How to check if an select element is still “open” / active with jquery</a> does not work because when I click the <code>select</code> element to display the options then click it again, the options are not displayed even though the <code>select</code> is still focused.</p>
  
  <hr>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Just in case I wasn't explicit enough, basically I want the console to log "displayed" or "not displayed" the user clicks on the <code>select</code> or the <code>option</code>s</p>