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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:38:06+00:00 2026-06-02T16:38:06+00:00

<c:forEach var=projects items=${projectList}> <tr> <td class=font > <a href=# id=projectname name=projectname class=testone >${projects.name}</a> </td>

  • 0
<c:forEach var="projects" items="${projectList}">
    <tr>
        <td class="font ">
            <a href="#" id="projectname" name="projectname" class="testone" >${projects.name}</a>
        </td>
        <input type="hidden" id="hello" value="${projects.projid}"/>
    </tr>                     
</c:forEach>

Basically, my code iterates one value from the database to the next. Specific to mention, the INPUT in <input type="hidden" id="hello" value="${projects.projid}"/> changes its value each iteration. However, when i select it through jQuery, i cannot get the 2nd value of PROJID from the database.

Here’s my jquery

$(document).ready(function(){
    $('#projectname').click(function(){
        $(this).each(function(i){
            var choice = $('#hello').val()  
            $('#right').load('show_project_details',{projectid:choice});
        });
    });
});

I know that selecting with an ID is restrained to the first element but doesnt my code have a work around? I’m really trying to avoid radio buttons.

If you have the time please do reply. Thank you very much!

  • 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-02T16:38:07+00:00Added an answer on June 2, 2026 at 4:38 pm

    An HTML id attribute should have a unique value within your whole HTML document.

    So, change your JSP like this:

    <c:forEach var="projects" items="${projectList}">
        <tr>
            <td class="font">
                <a href="#" class="projectname">${projects.name}</a>
            </td>
            <input type="hidden" name="projectid${projects.projid}" value="${projects.projid}" />
        </tr>                     
    </c:forEach>
    

    And then, use this JavaScript instead of yours:

    $(function() {
        $("a.projectname").click(function() {
            var choice = $(this).parent().next().val();
            $('#right').load('show_project_details', {projectid: choice});
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is My View: @foreach(var action in Model.Category.Actions) { <div class=action style=margin-right: 30px;> <input
Imagine that during a foreach(var item in enumerable) The enumerable items change. It will
I am trying to use the MethodInfo MakeGenericMethod as follows: foreach (var type in
foreach (var person in peopleList.Where(person => person.FirstName == Messi)) { selectPeople.Add(person); } I am
foreach (var book in query) { Response.Write(book.Title); foreach (var author in book.Authors) { Response.Write(
I have the following code: foreach (var control in this.Controls) { } I want
I think I'm having boxing issues foreach(var p in item.GetType().GetProperties(). Where(p => p.GetValue(original, null)
Any ideas on why this could be breaking? foreach (var p in pp) {
My understanding is nothing will happen. For instance this code: foreach (var some in
I have the following in my view: <%using (Html.BeginForm()) {%> <% foreach (var item

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.