Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7700459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:42:48+00:00 2026-05-31T22:42:48+00:00

I am using rails3 and on my page i am iterating a loop which

  • 0

I am using rails3 and on my page i am iterating a loop which have some records and i want when

user click on some row its color will be green and when he again click some row its color will

be green and the color of previous highlighted row should be none.

Thanks in advance

My code is like this

    <div class="top-heading-detail-admin">


    <div class="table-headings">
      <div class="email-admin"><p>Email</p></div>
      <div class="date-admin"><p>Date Added</p></div>
      <div class="added-by-admin"><p>Added by</p></div>

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

  </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:42:49+00:00Added an answer on May 31, 2026 at 10:42 pm

    I think you should use table why you are using div tags for table.If you want to highlight

    row using this.Try out this code i think its work..But you need to make an extra div inside it

     <div id="checkbox_list">
        <% @users.each do |user| %>
        <div id="<%= user.id %>" onclick="admin_select('<%=user.id%>')" class="admin-select">
          <div class="email-admin-detail"><%= user.email %></div>
          <div class="date-admin-detail"><%= user.created_at.strftime("%m/%d/%Y")%></div>
          <div class="added-by-admin-detail"><%= user.added_by %></div>
        </div>
    <% end %>
    

    i am making extra div and give this user id and also call onclick javascript event on it.

    Here is jquery code for it

     function admin_select(id) {
    $(".admin-select").children().each(function () {
        $(this).removeClass("color_class");
    });
    $("#" + id).children().each(function () {
        $(this).addClass("color_class");
    });
    

    }

    Check it….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using rails3 - I have a project with many tasks. I want to use
I am using rails beta 3 and I have a erb page named index.html.erb
I have a Ruby on Rails page that loads another page using jquery. I
Some of the users of our Ruby on Rails app have complained that page
I'm Using Rails3 and the Unobstrusive Javascript Gem jquery-rails . Remote deletion (without page
Using rails 2. I want a link to the current page (whatever it is)
I am using rails 2.3. I want to load parts of a page with
I have an existing Rails 3 application using ActiveRecord, and I want to switch
I am working on a web page that is using jQuery. I have an
I'm using Rails 3 and have have a page that outputs a list of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.