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 9244225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:58:33+00:00 2026-06-18T08:58:33+00:00

looking at how i can highlight a table row after dynamically adding it with

  • 0

looking at how i can highlight a table row after dynamically adding it with jquery
my code seems to be adding the row with no problems, but its not highlighting the correct row

jquery

$('#opponents tr:last').after('<tr><td>data</td><td>more data</td></tr>').effect("highlight", {}, 3000);

haml/table

%table.twelve#opponents
      %thead
        %tr
          %th Name
          %th Manager
      %tbody
        - @opponents.each do |opponent|
          %tr
            %td= opponent.name
            %td.span1
              - if can? :update, @opponent
                .btn-group
                  %button.btn.dropdown-toggle{"data-toggle" => "dropdown"}
                    %i.icon-pencil
                    Manage
                    %span.caret
                  %ul.dropdown-menu
                    %li= link_to "Edit #{opponent.name}", "#modalOpponent"
                    -if can? :manage, @opponent
                      %li.divider
                      %li= link_to "Delete #{opponent.name}", opponent, :method => :delete, :remote => :true, :confirm => true
  • 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-06-18T08:58:35+00:00Added an answer on June 18, 2026 at 8:58 am

    I would assume that the effect would be applied to what ever tr:last was as that is the main selector.

    after() returns the jQuery object from the original selector $('#opponents tr:last') allowing you to continue chaining on to that main selector.


    DEMO – Using existing code, wrong row is highlighted


    Try separating the new row into it’s own instead and applying the effect to it directly. Similar to this:

    var $newRow = $('<tr><td>data</td><td>more data</td></tr>');
    
    $('#opponents tr:last').after($newRow);
    $newRow.effect("highlight", {}, 3000);
    

    DEMO – Working DEMO of above code


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

Sidebar

Related Questions

Looking at the highlight JQuery effect: http://docs.jquery.com/UI/Effects/Highlight You can change the background color of
Hi I'm looking but can't see Is there a way to change the caption
Looking for a jQuery MultiSelect Widget that can handle thousands of items. Really like
Looking around, I can't name a single web application (not web service) that uses
I'm looking to dynamically highlight a tab, if it represents the current page. I
I'm looking for an existing semi-decent software that can highlight multiple search terms simultaneously,
I need to highlight source code in LaTeX. The package listings seems to be
Is there any syntax highlighter which can highlight the code inside the <pre> ?
I am looking for some control that can do following 2 : 1.highlight some
Been looking around and can't find a definite way to do this... I need

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.