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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:46:40+00:00 2026-05-20T17:46:40+00:00

Say I have a table html like so and jquery. I want to find

  • 0

Say I have a table html like so and jquery.

I want to find the value of groupid that have in Save click.

I am getting undefined value

<table border="0" id="tableJoinList" cellpadding="4" cellspacing="5">
<tr><td colspan="3" align="left" style="padding-bottom:7px">
    <img src="../../Content/Images/doublelinegray.jpg" alt="doublelinegray.jpg" width="480px" height="4px" />
</td></tr>
    @foreach (var item in Model.Groups)
    {
        <tr>
            <td>
                @Html.ActionLink("Join", "Join", new { id = item.GroupID }, new { @class = "Join" })
                @Html.Hidden("groupid", item.GroupID, new { @class = "groupid" })
            </td>
            <td align="left">
                @item.GroupName
            </td>
            <td>
                @item.DateAdded
            </td>
        </tr>
    }
<tr><td colspan="3" align="left">
    <img src="../../Content/Images/doublelinegrayreverse.jpg" alt="doublelinegrayreverse.jpg" width="480px" height="4px" />
</td></tr>
</table>

<script type="text/javascript">
$(function () {
    $(".Join").live("click", function () {
        var html = "<tr><td colspan='3'>Enter Password: &nbsp;&nbsp;<input type='password' class='pwd' />";
        html += "&nbsp;&nbsp;<input type='button' class='Save' value='Save' /></td></tr>";

        $(this).closest("tr").after(html);

        $(".Save").live("click", function () {
            alert($(this).siblings(".pwd").val());
            var json = { Password: $(this).siblings(".pwd").val(), GroupID: $(this).prev("tr").find(".groupid").val() };
            alert($(this).parent("tr").prev("tr").children(".groupid").val());
            return false;
            $.ajax({
                url: "/Group/ConfirmPassword",
                type: "POST",
                dataType: 'json',
                data: JSON.stringify(json),
                contentType: "application/json; charset=utf-8",
                success: function (result) {
                    if (result.Success == true)
                        window.location.href = result.Url;
                    else
                        alert(result.ErrorMessage);
                    return false;
                }
            });
        });
        return false;
    });
});
</script>
  • 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-20T17:46:40+00:00Added an answer on May 20, 2026 at 5:46 pm

    Ok, I found the problem. Using .parent("tr") only goes up one level in the DOM, the way it’s written is if the parent isn’t a “tr” (which is it actually a “td” in this case), ignore the rest. Also .children() only goes down one level, you’ll need to use .find() instead.

    So your alert should look like this:

    alert( $(this).closest("tr").prev("tr").find(".groupid").val() );
    

    Here is a basic demo.

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

Sidebar

Related Questions

Lets say I have a table with Groups of Questions GroupID | value --------+------
Lets say I have a view file that is built like this: <html> ...
I have an HTML table that I'm sorting with jQuery tablesorter. I have an
Let's say I have this text that I want to display in an HTML
Lets say I have table with ID int, VALUE string: ID | VALUE 1
Say I have this <table border=1 id=tbl> <tr> <td><input type=checkbox name=vehicle value=Bike /></td> <td>row
I have a html table like: <table ..... class=cars> <tr class=item-odd> ... </tr> <tr
I have created a table in Html and I would like to make a
Let's say we have the following html syntax: <TABLE width=400, height=300> <TR> <TD color=Red>SOME
the jquery plugin that im using is this http://code.google.com/p/jquery-in-place-editor/ if i have a table

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.