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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:19:22+00:00 2026-05-16T05:19:22+00:00

I have the following HTML in a JSP file: <div class=custList> <table class=dataGrid> <c:forEach

  • 0

I have the following HTML in a JSP file:

<div class="custList">
   <table class="dataGrid">
      <c:forEach var="cust" items="${custList}">
         <tr>
            <td>${cust.number}</td>
            <td>${cust.description}</td>
            <td>${cust.type}</td>
            <td>${cust.status}</td>
        </tr>
     </c:forEach>
  </table>
</div>

I need to be able to trigger a 'click' event on each of the dynamically created <tr> tags and also be able to access the values of the <td> tags (of the clicked <tr>) from within the JavaScript function. I have this function already, but sadly it doesn’t seem to be working.

$(document).ready(function() {
    $("div.custList > table > tr").live('click', function() {
        alert("You clicked my <tr>!");
        //get <td> element values here!!??
    });
});

Update (Jan 2016): jQuery.live is deprecated (as noted here:http://api.jquery.com/live/)

As of jQuery 1.7, the .live() method is deprecated. Use .on() to
attach event handlers.

  • 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-16T05:19:22+00:00Added an answer on May 16, 2026 at 5:19 am

    Unless otherwise definied (<tfoot>, <thead>), browsers put <tr> implicitly in a <tbody>.

    You need to put a > tbody in between > table and > tr:

    $("div.custList > table > tbody > tr")
    

    Alternatively, you can also be less strict in selecting the rows (the > denotes the immediate child):

    $("div.custList table tr")
    

    That said, you can get the immediate <td> children there by $(this).children('td').

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

Sidebar

Related Questions

I Have following in my struts.xml file <action name=ProductVerification class=com.frontend.ProductVerification> <result name=success>/jsp/product_verification.jsp</result> <result name=input>/jsp/product_verification.jsp</result>
For simplicity, i have the following file named test.jsp: <script language=javascript> alert(a$b.replace(/\$/g,k)); </script> I
I have the following form setup: <html> <head></head> <body> <form method=post enctype=multipart/form-data action=FileUpload> <table>
I am displaying ActionMessage s through a JSP file by the following command: <logic:messagesPresent
I have this simple JSP page in Eclipse and the first line in the
I've got a .jsp file that is working fine. It's maybe a bit special
I am trying to learn the Apache Struts framework and I have written a
I am trying to get a simple helloworld test project going so I can
I'm trying to add URL routing to a web application running in Tomcat 5.5.

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.