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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:11:19+00:00 2026-05-12T12:11:19+00:00

I have a dynamic list of items that will be used to POST information

  • 0

I have a dynamic list of items that will be used to POST information to the backend using AJAX.

<a href="...">Item 1</a>
<a href="...">Item 2</a>
<a href="...">.....</a>
<a href="...">Item n</a>

I’ve decided to include a css class and a hidden input on each item so that I can easily assign the handler (using the css class) and so that I can know the ID of the item (using the hidden field).

<a href="..." class="recorditem"><input type="hidden" value="1" name="ItemID"/>Item 1</a>
<a href="..." class="recorditem"><input type="hidden" value="2" name="ItemID"/>Item 2</a>
...
<a href="..." class="recorditem"><input type="hidden" value="n" name="ItemID"/>Item n</a>

Then with jQuery, I will intercept the click on the link (which would go to a page for non-javascript users) to do a POST. So it will look something like this:

 $("a.recorditem").click(function(){
        //get the item ID
        var itemID = $(this + " :input[name='ItemID']").val(); <-- PROBLEM

        //build a form dynamically - omitted for readability
        var formToAdd = "<input type='text'.... "
        //etc etc...
    });

Except, I cannot for the life of me figure out how to extract the value of the hidden input field from the link within.

What am I doing incorrectly? Better yet, is this even a smart way to do this for a dynamic list?

  • 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-12T12:11:20+00:00Added an answer on May 12, 2026 at 12:11 pm

    Not sure if a hidden input is valid in an anchor (W3c)…never tried it.

    Does the follwoing work

    var itemID = $(this).children().eq(0).val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a dynamic list picker script using Jquery 1.3 and PHP that
i have some dynamic code that will make a list of divs. i want
I have a product admin web site that has been generated using ASP.NET Dynamic
I have a dynamic list ( <ul><li></li></ul> )of items (three columns) I need to
I have already created a dynamic list view that passes text to a SimpleAdapter,
I have created an editor template for representing selecting from a dynamic dropdown list
I am creating a dynamic todo-list on a webpage. On the page you have
I have created a project in Dashcode, inserted a List control, enabled a dynamic
I have some divs that have dynamic heights controlled by a 'click' function as
I have some divs that have dynamic heights controlled by a 'click' function as

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.