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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:32:12+00:00 2026-05-29T22:32:12+00:00

I have the following (repeating) html: <tr> <td>Some text</td> <td><a href=#>Click me<a/></td> <td><form><input type=hidden

  • 0

I have the following (repeating) html:

<tr>
    <td>Some text</td>
    <td><a href="#">Click me<a/></td>
    <td><form><input type="hidden" value="4"/></form></td>
</tr>

Using jQuery on the click event of the link I want to retrieve the value of the input element. I have tried all kinds of parents(), children(), nextAll(), prev() combinations but I can not get the value of the input element.

Here is a link to my testing functions. jsFiddle Link

Additionally how would i retrieve the text of the first td element?

Thanks a lot for helping me achieve this.
Michael

  • 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-29T22:32:13+00:00Added an answer on May 29, 2026 at 10:32 pm

    You can use parent to get to the td from the a, then next to get to the following td, and then find to get to the input element:

    $("a").click(function() {
        var value = $(this).parent().next().find("input").val();
    });
    

    Here’s an updated fiddle.

    To get the text from the first td you can take pretty much the same approach, but use prev instead of next.

    Also, seeing as you have several repetitions of the HTML snippet, it’s probably going to be more efficient to bind the click event handler higher up the DOM tree (maybe you already are, you haven’t posted any JS so I don’t know):

    $("table").on("click", "a", function() {
        //Do stuff
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML <p><input id=revenue type=text value=100000 /><span id=howmuch><a href= class=ka_button small_button
I have the following HTML and CSS: <div class=content> <div class=leftbg></div> <div class=innercontent><p>Some content
I have the following HTML: <h3 onclick=replaceNextChild(this);>Some content...</h3> <div>Div that I am interested in
I have the following code: address = #{(article/div.address).inner_html.strip_html.squish} (using Hpricot) And in some instances...
I have the following form: <html> <body> <form action=upload_file.php method=post enctype=multipart/form-data> <label for=file>Filename:</label> <input
I have following string String str = replace :) :) with some other string;
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have following text in a file 23456789 When I tried to replace the
We have rtf text stored in our database that looks like the following: {\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0
I have the following HTML. <div class=red>Div One</div> <div class=green>Div Two</div> <div class=blue>Div Three</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.