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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:35:09+00:00 2026-05-23T12:35:09+00:00

I have a dynamic table with each row having 4 columns. Column 1 has

  • 0

I have a dynamic table with each row having 4 columns.

  • Column 1 has a label.
  • Column 2 has an input type=text of class gvRate.
  • Column 3 has an input type=text of class gvMax.
  • Column 4 has a button image with a name attribute of the record’s id.

I am trying to ascertain the values of the inputs when the button is clicked but the alert is something like “3 undefined undefined”. I know I am not using one of the selectors correctly but not sure which.

Here’s the code:

    $(document).ready(function() {
     $("img.btnUpdate").click(function(){
     var id = $(this).attr("name");
     var rate = $(this).parent().find(".gvRate").val();
     var max = $(this).parent().find(".gvMax").val();
     alert(id + ' ' + rate + ' ' + max);
     }); // end btnUpdate click
}); // end document.ready function

Here’s the HTML (sort of)

     <div id="editInnerContent">    
      <table id="gvEdit" align="center" border="1" cellpadding="5px" style="width:600px;">
   <tr>
        <th style="width:40%;text-align:center;">ITEM</th>
        <th style="width:20%;text-align:center;">RATE</th>
        <th style="width:20%;text-align:center;">MAX</th>
        <th style="width:20%;"></th>
   </tr>

     <?php
 foreach( $globalVars as $arrGV){
      echo "<tr>";
      echo "<td><label class='gvItem'>" . $arrGV['item'] . "</label></td>";
      echo "<td><input type='text' class=gvRate' value='" . $arrGV['rate'] . "' /></td>";
      echo "<td><input type='text' class=gvMax' value='" . $arrGV['max'] . "' /></td>";
      echo "<td style='text-align:center;'><img class='btnUpdate' name='" . $arrGV['id'] . "' src='" . base_url() .  "images/update.png' /></td>";
      echo "</tr>";
 } // end foreach
   ?>
      <tr>
   <td colspan="3">
        &nbsp;
   </td>
      </tr>
      <tr style="background:#DC241F;">
   <td colspan="4" style="text-align:center;">
        <img id="btnExitGlobalValues" src="<?php echo base_url();
            ?>images/exitGlobalValues.png" />
   </td>
      </tr>
      </table>
 </div> <!-- END editInnerContent 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-23T12:35:10+00:00Added an answer on May 23, 2026 at 12:35 pm

    If this is a real HTML table you need to go up two levels of parent.

    The first call to .parent() will take you to the <td>, and then you need another to get to the <tr>.

    Alternatively use:

    $(this).closest('tr').find(...)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have generated a table using PIVOT and the ouput of columns are dynamic.
Consider the following HTML table: <table id=myTable1> <tr id=TR1> <td><input type=text id=quantity1 name=quantity1 /></td>
I have a table with almost 800,000 records and I am currently using dynamic
I am using ASP.NET Dynamic Data for a project and I have a table
I have a dynamic class that serves as a storage container for configuration settings.
I have this scenario... 1.- I'm providing a Dynamic Table for wich users can
I am creating a dynamic table of three columns and multiple rows. I want
i have the table of rows which are dynamic in nature from server side
I have table which contains the rows that are dynamic from server side scripting(PHP)
I have dynamic divs as rows: <table border=1><tr><td> <div id='div1'>fgg</div> <div id='div2'>dfgdfg</div> <div id='div3'>vcbcvb</div>

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.