title: Check if an item is not selected from a dropdown
body: <p>I have a dropdown list that is generating dynamically using PHP. Its rendered HTML is something similar to below markup - </p>
  
  <pre><code>&lt;select size="8" id="email" name="email"&gt;
      &lt;option value="6" data-userId="uid6"&gt;kamala@gmail.com&lt;/option&gt;
      &lt;option value="8" data-userId="uid8"&gt;tk@g.com&lt;/option&gt;
      &lt;option value="3" data-userId="uid3"&gt;myexample.com&lt;/option&gt;
      &lt;option value="7" data-userId="uid7"&gt;samadhi@gmail.com&lt;/option&gt;
      &lt;option value="2" data-userId="uid2"&gt;facebook.com&lt;/option&gt;
      &lt;option value="4" data-userId="uid4"&gt;lankainstitute.com&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Using this markup, just I want to check whether item is selected or not using JavaScript. If it is not selected an item, then I need to get an alert message. </p>
  
  <p>I tried it something like this. But I can not get it to work. </p>
  
  <p>JavaScript - </p>
  
  <pre><code>var email = document.getElementById("email");
  var selectedValue = email.options[email.selectedIndex].value;
  
  if (selectedValue == '') {
      alert("Please select a email");
  }
  </code></pre>
  
  <p>Hope somebody may help me out. 
  Thank you. </p>