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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:52:58+00:00 2026-06-04T20:52:58+00:00

I’m using jQuery 1.6.4 and I have an array of values I’m getting from

  • 0

I’m using jQuery 1.6.4 and I have an array of values I’m getting from an html table. What I’m trying to do is get the value from a specific td when the user clicks on the row. I used this code to get all the td values from the particular row:

jsp code:

<tr>
<s:iterator value="model.NameList">
<tr>
   <td align=center><s:property value="message.substring(0,125)"/></td>
   <td align=center><s:property value="timestamp"/></td>
   <td align=center><s:property value="retryCount"/></td>
   <td align=center><s:property value="specialId"/></td>
...
   </tr>
  </s:iterator> ...

specialId is the td cell value I need to get from each selected row from the click event.

//Click event code left out.

var arr = [];
arr = $(this).find('td').map(function(){     
return this.innerHTML;   
}).get();  

Then I need to check for a particular cells value using an if block as I loop through the cells in that row. I hardcoded it as in the code below to get the value, but I need to do this dynamically.

$.each(arr, function(i, l){ 
    if(i == 6) { ...

So I created an id for the td cell to get that value, but I’m going to need to get this particular cells value from multiple rows so the id by itself wont work. I need to handle getting the value from the row and then getting it from multiple rows if the user selects more than one row and send that value to Struts2 hidden textboxes. I’m just using one textbox to start with and that worked.

$('#textboxId').val(l); //Set the value to the id of a hidden textbox.

Am I going about this the wrong way? Since I only need one value from each row, I’m thinking there is a better way to code this, but I also need to allow for n(values) of td’s.

How can I do 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-04T20:53:01+00:00Added an answer on June 4, 2026 at 8:53 pm

    On click of row you can get the value using something like this:

    jQuery('table tr').click(function(){
       jQuery('#hiddenInputText').val('jQuery(this).find('#thisone').text()'); 
       //thisone is the id of the id whose value should be fetched
    });​
    

    say if your textfield is like

    <s:inputText id="hiddenInputText" />
    

    JS Fiddle

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a text area in my form which accepts all possible characters from
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.