title: jQuery: check if element has CSS attribute
body: <p>Is there a way to check an elements parents and find the first one that has a CSS background set and then return that background value?</p>
  
  <p>Something like:</p>
  
  <pre><code>var background = $('element').parents().has(css('background'));
  </code></pre>
  
  <p>UPDATE:
  This is the code I'm now using:</p>
  
  <pre><code>jQuery.fn.getBg = function(){
      var newBackground = this.parents().filter(function() {
          return $(this).css('background-color').length &gt; 0;
      }).eq(0).css('background-color');
      $(this).css('background-color',newBackground); console.log("new background is: "+newBackground);
  };
  </code></pre>