title: How to change CSS with jquery?
body: <p>I have the following HTML generated dynamically by PHP.
  When I click active, it changed to inactive and vise versa.</p>
  
  <p>I added div class='status' for jquery manipulation. (Do I need it? Can I do it without this div?)</p>
  
  <p>I want to change CSS class='status' to class='inactive' when I click active and when I click inactive changing CSS class to 'active' as well, so that I can change a color or add bg image etc.</p>
  
  <p>HTML</p>
  
  <pre><code>...
  ...    
  &lt;tr valign='top'&gt;
    &lt;td align='center'&gt;21&lt;/td&gt;
    &lt;td&gt;Kontakt&lt;/td&gt;
    &lt;td&gt;/kontakt.html&lt;/td&gt;
    &lt;td align='center'&gt;
       &lt;div class="status"&gt;
         &lt;a href="http://127.0.0.1/ci/index.php/admin/pages/changePageStatus/21"&gt;active&lt;/a&gt;
       &lt;/div&gt;
    &lt;/td&gt;
    &lt;td align='center'&gt;...
    ...
    &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I am using jquery and I need some guidance. </p>
  
  <p>Can anyone tell me some jquery code please?</p>
  
  <p>--UPDATE--</p>
  
  <p>There are many div with calss='status', so how can I tell jquery that I want to change the css which I clicked.</p>
  
  <p>--UPDATE 2--</p>
  
  <p>I want to check the value(active/inactive). And add it's value as class. e.x If its value is active, then add css class='active' and if it is inactive then  class='inactive' etc.
  Can I do it?
  Or you have other suggestions how I should do it. </p>
  
  <p>--UPDATE 3--</p>
  
  <p>Thanks everyone. You guys rock. I tested some of codes. But the problem is that when I click active, it change the bg, but then refreshes the page to change to inactive via php/mysql. So this means each time I click the value(active/inactive) changes. So I think as I stated in update 2, it might be good idea to add css class depends on the value. 
  More suggestions are welcome and I appreciate them. (I have not done it with AJAX yet...)</p>
  
  <p>--UPDATE 4 --</p>
  
  <p>Using ID is not a good idea since the table is created dynamically. I can add IDs but it will add more code. So I thought class is better.</p>
  
  <p>--UPDATE 5--</p>
  
  <p>I moved my question here. <a href="https://stackoverflow.com/questions/1909223/how-to-add-a-class-depends-on-value-with-jquery">How to add a class depends on value with jquery</a></p>
  
  <p>After this, I now know what I want to do. </p>