title: mousedown event on options in select with jquery .on
body: <p>I was reading the <a href="http://api.jquery.com/on/" rel="nofollow">documentation of the .on event handler of jQuery</a> and I started playing around with it.</p>
  
  <p>I have a simple &lt;select&gt; element with the multiple attribute set to true.
  However, I want the user to be able to select multiple items without having to press the ctrl or shift key(s)</p>
  
  <p>According to the .on documentation, if you specify a selector it will automatically add those event handlers to any new items added inside that container that match the selector specified.</p>
  
  <p>So in my case, I could for example decide to replace the &lt;option&gt; elements available in the listbox, but I still want to have the same functionality for those options without having to rebind those events etc.</p>
  
  <p>One might think that the following snippet should do the trick (atleast, I did):</p>
  
  <pre><code>$('#dropdownlist').on('mousedown', 'option', function(e){
      e.preventDefault();
      $(this).prop('selected', $(this).prop('selected') ? false : true);
      return false;
  });
  </code></pre>
  
  <p>So when a users clicks on an option in that listbox, the default action will be cancelled and depending wether the item is already selected or not, it will invert that selection.</p>
  
  <p>I have created a small fiddle demonstrating this behaviour: <a href="http://jsfiddle.net/dschuermans/pEmpG/" rel="nofollow">fiddle</a></p>
  
  <p>In that fiddle, the first dropdownlist is behaving as expected, but the functionality is lost when replacing the items. This only works in FF &amp; Chrome.</p>
  
  <p>The second dropdownlist is how I thought it should've been (event handling wise), but that doesn't seem to work besides in Chrome -.-
  The functionality is kept when replacing items, because the console will still log '2' when clicking on an item after replacing them.</p>
  
  <p>Can someone explain me why this is happening? Am I doing something wrong?
  Please point me in the right direction!</p>
  
  <p>Thanks!</p>
  
  <p>~ Dirk</p>