title: Multiple Select limit number of selection
body: <p>I want user to select maximum of only three options from multiple select options. I tried this code so far:</p>
  
  <pre><code>&lt;select id="userRequest_activity" required name="activity[]" class="multiselect form-control" multiple="multiple"&gt;
      &lt;option value="2"&gt;Bungee Jumping&lt;/option&gt;
      &lt;option value="3"&gt;Camping&lt;/option&gt;
      &lt;option value="5"&gt;Mountain Biking&lt;/option&gt;
      &lt;option value="6"&gt;Rappelling&lt;/option&gt;
      &lt;option value="7"&gt;Rock Climbing / Bouldering&lt;/option&gt;
      &lt;option value="8"&gt;Skiing&lt;/option&gt;
      &lt;option value="10"&gt;Wild Life (Safari)&lt;/option&gt;
      &lt;option value="11"&gt;Canoeing &amp;amp; Kayaking&lt;/option&gt;
      &lt;option value="12"&gt;Rafting&lt;/option&gt;
      &lt;option value="13"&gt;Sailing&lt;/option&gt;
      &lt;option value="14"&gt;Scuba Diving&lt;/option&gt;
      &lt;option value="15"&gt;Snorkeling&lt;/option&gt;
      &lt;option value="16"&gt;Surfing&lt;/option&gt;
      &lt;option value="18"&gt;Hang Gliding&lt;/option&gt;
      &lt;option value="19"&gt;Hot-air Ballooning&lt;/option&gt;
      &lt;option value="20"&gt;Micro-light Aircrafts&lt;/option&gt;
      &lt;option value="21"&gt;Paragliding&lt;/option&gt;
      &lt;option value="22"&gt;Paramotoring&lt;/option&gt;
      &lt;option value="23"&gt;Parasailing&lt;/option&gt;
      &lt;option value="24"&gt;Skydiving / Parachuting&lt;/option&gt;
      &lt;option value="25"&gt;Zip-line / Flying Fox&lt;/option&gt;
      &lt;option value="26"&gt;Caving&lt;/option&gt;
      &lt;option value="27"&gt;Cycling&lt;/option&gt;
      &lt;option value="28"&gt;Fishing &amp;amp; Angling&lt;/option&gt;
      &lt;option value="29"&gt;Motorbike trips&lt;/option&gt;
      &lt;option value="30"&gt;Nature Walks&lt;/option&gt;
      &lt;option value="31"&gt;Road Trips&lt;/option&gt;
      &lt;option value="32"&gt;Zorbing&lt;/option&gt;
      &lt;option value="33"&gt;Trekking Hiking and Mountaineering&lt;/option&gt;
      &lt;option value="34"&gt;Backpacking&lt;/option&gt;
      &lt;option value="61"&gt;Water&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>The javascript code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $("select").change(function() {
      if ($("select option:selected").length &gt; 3) {
          $(this).removeAttr("selected");
          alert('You can select upto 3 options only');
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>This code shows the alert box when selected more than 3 options but still allow access to select the 4th, 5th, 6th and so on selections with the alert box appearing. How to validate this?</p>