title: Remove class of last element in element
body: <p>i am trying to remove the class of the last list item. But jQuery only removes the class of both list items after 2 clicks.</p>
  
  <p>What am i doing wrong here? Why does jQuery not remove only the last class? And if only one list item with this class exist, just remove this class.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$( "#test" ).click(function() {
    $("ul li.visible").last().removeClass( "visible" );
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>a {
    color:blue;
  }
  .visible {
    color:red;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;a id="test"&gt;Click me -&gt; Remove last&lt;/a&gt;
  &lt;ul&gt;
    &lt;li&gt;Bla
      &lt;ul&gt;
        &lt;li class="visible"&gt;Foo
          &lt;ul&gt;
            &lt;li class="visible"&gt; Bar&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;</code></pre>
  </div>
  </div>
  </p>