title: jquery if background color ==
body: <p>I am trying to check for the background of an element, here is my code. But it doesn't work:</p>
  
  <p>I tried two ways, here is the first:</p>
  
  <pre><code>function changeColor(field) {
       if(field.css('background-color','#ffb100')) {
            field.css('background-color','white');
       }
       else {
            field.css('background-color','ffb100');
       }
  }
  </code></pre>
  
  <p>here is the second:</p>
  
  <pre><code>function changeColor(field) {
       if(field.css('background-color') === '#ffb100') {
            field.css('background-color','white');
       }
       else {
            field.css('background-color','ffb100');
       }
  }
  </code></pre>
  
  <p>But neither worked! Any suggestions?</p>
  
  <p>EDIT: This is my latest code, but it still is not working:</p>
  
  <pre><code>function changeColor(field) {
                  if(field.css('background-color') == 'rgb(255, 255, 255)') {
                      field.css('background-color','ffb100');
                  }
                  else {
                      field.css('background-color','white');
                  }
              }
  </code></pre>