title: Issue with jQuery : Click event & Switching between "active" elements
body: <p>OK, here's my issue and <del>I bet it'll be super-easy for you</del> (I guess it wasn't... lol).</p>
  
  <p>So, let's say I'm having several <code>div</code>s. Once the user clicks on one of them, I want to highlight just this one. In a few words : a) remove (if exists) a specific class from all <code>div</code>s, b) add it to the <code>div</code> being clicked.</p>
  
  <p>And here's the full code...</p>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt; 
  &lt;html style='min-height:0px;'&gt; 
  &lt;head&gt; 
      &lt;title&gt;Page Title&lt;/title&gt; 
  
      &lt;meta name="viewport" content="width=device-width, height=device-height, initial-scale=1"&gt; 
  
      &lt;link rel="stylesheet" href="jquery.mobile.min.css" /&gt;
      &lt;link rel="stylesheet" href="custom.css" /&gt;
  
      &lt;script src="jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="jquery.mobile.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt; 
  
  &lt;body&gt; 
      &lt;div data-role="page"&gt;
  
  
      &lt;/div&gt;
      &lt;script src="custom.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>custom.js</strong></p>
  
  <pre><code>$(function() {
      $("div").click( function() {
          $("div").removeClass("msp-selected");
          $(this).addClass("msp-selected");
      });
  });
  </code></pre>
  
  <p><strong>custom.css</strong></p>
  
  <pre><code>media screen and (orientation: portrait) {
      .ui-mobile, .ui-mobile .ui-page {
          min-height: 420px;
      }
  }
  media screen and (orientation: landscape) {
      .ui-mobile, .ui-mobile .ui-page {
          min-height: 300px;
      }
  }
  
  div {
      outline:0;
  }
  
  div:hover {
      outline-width:1px;
      outline-color:red;
      outline-style: dotted;
      overflow:hidden;
  
  }
  
  .msp-selected {
      outline-width:1px;
      outline-color:red;
      outline-style: solid;
  }
  </code></pre>
  
  <hr>
  
  <p><strong>P.S.</strong> </p>
  
  <ul>
  <li><p>The situation may not be as simple as it initially seemed. I'm using jQuery 1.8.2 and jQuery Mobile 1.3.2. And the actual page is running inside a Webview, itself inside a Cocoa/OS X app. Quite complicated, huh? lol</p></li>
  <li><p>I can't see any error (not easy to have access to a console that... doesn't exist...). The only thing that I noticed is that when I remove the <code>removeClass</code> part, it does work. Adding it, seems to make the whole thing a mess.</p></li>
  </ul>