title: jQuery - selecting previous element link
body: <p>I can't see why this isn't working. I have a list, each item has a background image on the anchor. With jQuery I'm trying to remove the background image on the item right before the selected anchor. Here is the HTML:</p>
  
  <pre><code>&lt;ul id="menu"&gt;
  &lt;li class="last"&gt;&lt;a href="#"&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Testimonials&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Projects&lt;/a&gt;&lt;/li&gt;
  &lt;li class="selected"&gt;&lt;a href="#"&gt;Our Services&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;About Us&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>And here is the jQuery I am using to try and remove the background image (using display:none for testing purposes):</p>
  
  <pre><code>$('li.selected a').prev().css( {display : "none"});
  </code></pre>
  
  <p>When I use the following, it works:</p>
  
  <pre><code>$('li.selected').prev().css( {display : "none"});
  </code></pre>
  
  <p>But as soon as I involve the anchor tag, it stops.</p>
  
  <p>TLDR: Basically I need to select "projects" which is before the selected link, and remove its background image tied to it (to the link, not the list item). Can anyone tell me why that code isn't working?</p>
  
  <p>Thanks</p>