title: jquery - how to set parent attribute?
body: <p>I'm trying to write an if statement where if one of the elements has it's display set to "none", I want the parent element to also display "none"...  </p>
  
  <p>This is the code I'm trying, which doesn't work...</p>
  
  <pre><code>/* tried this first */
  if($('#prevx a').attr('display') == 'none') {
      $(this).parent().attr('display','none');
  }
  
  /* and then this */
  if($('#prevxa &gt; a').attr('display') == 'none') {
      $('#prevxa').attr('display','none');
  }
  </code></pre>
  
  <p>The markup looks like this:</p>
  
  <pre><code>&lt;ul&gt;
     &lt;li class="navnext" id="nextxa"&gt;
        &lt;a id="nextx" href="#"&gt;&lt;img src="/images/next.png"/&gt;&lt;/a&gt;
     &lt;/li&gt;
  
     &lt;li class="navprev" id="prevxa"&gt;
        &lt;a id="prevx" href="#" style="display: none;"&gt;&lt;img src="/images/previous.png"/&gt;&lt;/a&gt;
     &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>