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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:27:58+00:00 2026-06-05T03:27:58+00:00

I am trying to solve an issue I have where I need to grab

  • 0

I am trying to solve an issue I have where I need to grab the action="/uri/" from the parent form when a user clicks the submit button. If I use $(form).live('submit') it only works half the time. So I am using $('input[type=""]').live('click') instead. However as you can see in the code below, I am trying to grab the action attribute and it does not recognize it, or rather I can’t seem to grab the .attr('action') off of it.

<script>
var get_pages_load_options = { 
    target:        '#content',
    beforeSubmit:  showRequest,
    success:       showResponse
};
$('input[type="submit"]').live('click',function(event){
    var url = $(this).closest("form").attr('action');
    var named = $(this).closest("form").attr('id')
    console.debug(url+"/"+named);
    $("#"+named).ajaxForm(get_pages_load_options);
    $.ajax({
        type: "POST",
        url: url,
        data: {ajaxtype: "side"},
        success: function(data) {
            $("#sidebar_menu").html(data);
        }
    });
    event.preventDefault();
    return false;
});
</script>

The html that I am trying to use looks like this (removed PHP for readability sake):

<tr>
    <td class="bold" colspan="2">
        <form id='defcon_form' name='defcon_form' action='/cityhall/' method='post'>
            <div class="left">
                Realm Hoarding 
                <select name='defcon_rate'>
                    <option value='0'>None</option>
                    <option value='10'>Low</option>
                    <option value='20'>Medium</option>
                    <option value='30'>High</option>
                    <option value='50'>Critical</option>
                </select><br />
                <font size='-4'>(Stashes Gold/Turn, Decreases Defense)</font>
            </div><div class="right">
                <input type='submit' name='defcon' value='Update Hoarding!' />
            </div>
        </form>
    </td>
</tr>

I know the HTML isn’t the best and I will need to go back and revise it a bit.

  • 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-05T03:28:01+00:00Added an answer on June 5, 2026 at 3:28 am

    Your HTML is invalid. <tr></tr> elements can only contain <td></td> and <th></th> elements. Invalid html will have inconsistent results across browsers or possibly not work at all in any browser.

    https://developer.mozilla.org/en/HTML/Element/tr

    Wrap the form around the entire table instead of each tr, and give each tr a data-key to contain the id of the given tr. With that, you can catch any submit that gets to the form, get the id of the current row by using $(this).closest('tr').data("key"), then post the values from the inputs within said tr.

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

Sidebar

Related Questions

Trying to solve an issue for someone else and instead have run into my
I'm trying to solve an issue with makefile. I have a main.cpp and then
The issue I am trying to solve is that I have a folder with
I have been trying for hours to find a way to solve the issue,
I'm trying to start a text editor (nano) from inside Python, have the user
Since almost 4-5 months I am trying to solve this issue where user role
I have a rather complicated issue that I am trying to solve in PHP
I have a linq issue that I am trying to solve, I have some
I am trying to solve an issue when using a Castle ActiveRecord TransactionScope which
I'm trying to solve an issue where a script crashes with little-to-no error information

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.