Highlight table row with some background color
<p>I am using rails3 and on my page i am iterating a loop which have some records and i want when </p>

<p>user click on some row its color will be green and when he again click some row its color will </p>

<p>be green and the color of previous highlighted row should be none.</p>

<p>Thanks in advance</p>

<p>My code is like this </p>

<pre><code>    &lt;div class="top-heading-detail-admin"&gt;


    &lt;div class="table-headings"&gt;
      &lt;div class="email-admin"&gt;&lt;p&gt;Email&lt;/p&gt;&lt;/div&gt;
      &lt;div class="date-admin"&gt;&lt;p&gt;Date Added&lt;/p&gt;&lt;/div&gt;
      &lt;div class="added-by-admin"&gt;&lt;p&gt;Added by&lt;/p&gt;&lt;/div&gt;

    &lt;/div&gt;
   &lt;div id="checkbox_list"&gt;
       &lt;% @users.each do |user| %&gt;
         &lt;div class="email-admin-detail"&gt;&lt;%= user.email %&gt;&lt;/div&gt;
         &lt;div class="date-admin-detail"&gt;&lt;%= user.created_at.strftime("%m/%d/%Y") unless  user.created_at.blank? %&gt;&lt;/div&gt;
         &lt;div class="added-by-admin-detail"&gt;&lt;%= user.added_by %&gt;&lt;/div&gt;
         &lt;/div&gt;
       &lt;% end %&gt;
    &lt;/div&gt;

  &lt;/div&gt;
</code></pre>
