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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:16:24+00:00 2026-06-03T06:16:24+00:00

My html contains a table have the structure like this <table id=sample> <tr class=new_input_field>

  • 0

My html contains a table have the structure like this

<table id="sample">
 <tr class="new_input_field">
   <td><input type="text" class="first_input" /></td>
   <td><input type="text" class="second_input" /></td>
   <td><a href="#" class="first_link">Button1</td>
   <td><a href="#" class="second_link">Button2</td>
 </tr><tr class="new_input_field">
   <td><input type="text" class="first_input" /></td>
   <td><input type="text" class="second_input" /></td>
   <td><a href="#" class="first_link">Button1</td>
   <td><a href="#" class="second_link">Button2</td>
 </tr>
 <tr class="new_input_field">
   <td><input type="text" class="first_input" /></td>
   <td><input type="text" class="second_input" /></td>
   <td><a href="#" class="first_link">Button1</td>
   <td><a href="#" class="second_link">Button2</td>
 </tr>
</table>

And for each row in my jquery the values for first_input and second_input value change triggers a call to server and that row will be replaced by like this.

<tr id="AIK">
<td>some content</td>
<td>some other content</td>
<td><a href="#" class="first_link">Button1</td>
<td><a href="#" class="second_link">Button1</td>
</tr>

My Problem is when i click the buttons in dynamically replaced row should show alert. I gave jquery

$('#sample tr td a.first_link').click(function () {
 trid = $(this).closest('tr').attr('id');
 if(trid.length > 0) { alert("Swap out will come soon"); }
});

This works fine for newly replaced row and shows error with remaining two rows as

TypeError: Result of expression 'trid' [undefined] is not an object.

The buttons should be enable for newly replaced rows only. How can i solve this?

  • 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-03T06:16:25+00:00Added an answer on June 3, 2026 at 6:16 am

    You have to assign id first to closest tr and then try like following:

    $('#sample tr td a.first_link').click(function () {
     var trid = $(this).closest('tr').attr('id');
     if(trid.length > 0) { alert("Swap out will come soon"); }
    });
    

    if you don’t put id then you can try:

    var trid = $(this).closest('tr').attr('id') || '';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a html page that contains a structure like this: <table class=pick> <tr>
I have a javascript string contains html table like this: <div class=nobrtable><table class=at><TBODY><TR><td> FY
I have written xml file which contains html tags as element like <component> <input
I have a row in an html-table that contains only images. (this happens to
I have an HTML table that contains 500 e-mail addresses in this file.html .
I have an HTML Table that looks like this: The user can update any
I have a fairly simple dynamic html structure of a table that contains links
I have a table structure for displaying posts like this: <table> <tr><td>heading of the
I have a simple HTML input file; which contains a table. The column headers
My situation is this: I have an html page which contains a table 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.