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

  • Home
  • SEARCH
  • 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 8891605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:47:18+00:00 2026-06-14T22:47:18+00:00

I have a html table for display user list. when i click a tr

  • 0

I have a html table for display user list. when i click a tr row, that time it will find the td values to text-box which is in another html table.

Assume, the given below html table is user list table,

<table id="tbl1" border="1">
   <tr>
       <td>name</td>
   </tr>
   <tr id="tr1" style='cursor:pointer;'>
       <td>Mani</td>
   </tr>
</table>

And the given below html table for when we click a row in above html table dynamically assign the td values to text-box , like

<table id="tbl2">
   <tr>
       <td><input id="txt1" type="text"  /></td>
   </tr>
</table>
<br/>
<input type="button" id="btnReset" value="reset" />

What i did, when i click a row in that table, i get a html data & assign this to a global variable & when i click reset button that time, just i insert the html values to the #tbl2.

My jquery code is given below,

var getHTML="";

$("#tr1").click(function(){    
   $("#txt1").val($(this).find('td').html());
   getHTML=$("#tbl2").html();
});

$("#btnReset").click(function(){
    $("#tbl2").html(getHTML);
});

It’s working but text-box value are empty, How to i get the dynamic text-box values from html table.

Check here

  • 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-14T22:47:19+00:00Added an answer on June 14, 2026 at 10:47 pm

    Try this

    $("#txt1").attr('value', $(this).find('td').text());
    

    instead of

    $("#txt1").val($(this).find('td').text());
    

    to add the value in your text box source like

    <input id="txt1" type="text" value="Mani">
    

    Update: Or you may try this too.

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

Sidebar

Related Questions

I have HTML table. I'm looping through table and iterate over each row whose
I have an HTML table in my jsp page. This conains text fields and
I have an HTML table that contains some 500 rows. I have an input
I have a table row that contains a link in it. I set the
I'm trying to display an HTML table of values with about 20 columns where
I have a form that the user will use to enter in the title
I have a HTML form, which includes radio buttons that the user can select
I am using display tag to show user list on my JSP. I have
i have a page that displays large datasets into html tables. how can i
see fiddle i have html table and one textbox and one button.make cell selection

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.