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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:07:18+00:00 2026-05-30T15:07:18+00:00

I have a table which I need to show and hide up to 9

  • 0

I have a table which I need to show and hide up to 9 tr’s of a table in groups of 3. I have loop through a single tr 9 times to produce all 9. The .hide works, but the .show does not And the jquery doesn’t break midway through (I have put alert() all through out the code and even used alert() to display which attendeerow I am trying to show or hide and the values are correct.

here is the snippet which creates the tr’s

<cfloop index="i" from="1" to="9" step="1">


        <tbody id="attendeeRow<cfoutput>#i#</cfoutput>">
        <tr>
          <td colspan="2" bgcolor="#693505">
            <table width="600" border="0" align="center" cellpadding="4" cellspacing="0">
                <tr>
                  <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                  <td width="185" align="right">*Attendee <cfoutput>#i#</cfoutput> Name<br /></td>
                  <td><span id="sprytextfield100<cfoutput>#i#</cfoutput>">
                    <input name="attendeeName<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
                    <span class="textfieldRequiredMsg"></span></span></td>
                </tr>
                <tr>
                  <td align="right">*Attendee <cfoutput>#i#</cfoutput> Title<br /></td>
                  <td><span id="sprytextfield101<cfoutput>#i#</cfoutput>">
                    <input name="attendeeTitle<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
                    <span class="textfieldRequiredMsg"></span></span></td>
                </tr>
                 <tr>
                  <td align="right">*Attendee <cfoutput>#i#</cfoutput> Company</td>
                  <td><span id="sprytextfield102<cfoutput>#i#</cfoutput>">
                    <input name="attendeeCompany<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
                    <span class="textfieldRequiredMsg"></span></span></td>
                </tr>
                <tr>
                  <td align="right">*Attendee <cfoutput>#i#</cfoutput> Email</td>
                  <td><span id="sprytextfield103<cfoutput>#i#</cfoutput>">
                  <input name="attendeeEmail<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
                  <span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg"></span></span></td>
                </tr>

            </table>
          </td>
        </tr>
        </tbody>
        </cfloop>

        <!---- comment: this bottom part is what allows the user to show or hide the elements, I just use the div with an id="counter" to keep track of where I am.--->
        <tr>
            <td colspan="2" align="center" bgcolor="#693505" class="form">
                <div id="counter" style="visibility:hidden;">0</div>
                <div id="additional3">[+] Click here to register an additional 3 attendees</div>
                <div id="subtract3">[+] Click here to remove the last 3 attendees</div>
            </td>
        </tr>

And here is the jquery;

$(document).ready(function () {

for (loopIndex = 1; loopIndex <= 9; loopIndex++)
{

    var currentRow = "attendeeRow" + loopIndex;

    var currentName = "attendeeName" + loopIndex;
    var currentTitle = "attendeeTitle" + loopIndex;
    var currentCompany = "attendeeCompany" + loopIndex;
    var currentEmail = "attendeeEmail" + loopIndex;



    $("#"+currentRow).hide();

    $("#"+currentName).val("--");
    $("#"+currentTitle).val("--");
    $("#"+currentCompany).val("--");
    $("#"+currentEmail).val("a@b.c");

}


$("#subtract3").hide(); 
$("#additional3").show();

$("#additional3").live("click", function(e) {

    e.preventDefault();

    var start = $("#counter").text(); 
    var increment = "3";
    var end = parseInt(start) + parseInt(increment); 


    for (loopIndex = start; loopIndex <= end; loopIndex++)
    {
        var currentRow = "attendeeRow" + loopIndex;

        var currentName = "attendeeName" + loopIndex;
        var currentTitle = "attendeeTitle" + loopIndex;
        var currentCompany = "attendeeCompany" + loopIndex;
        var currentEmail = "attendeeEmail" + loopIndex;

        alert("#"+currentRow);
        $("#currentRow").show();

        $("#"+currentName).val("");

        $("#"+currentTitle).val("");

        $("#"+currentCompany).val("");
        $("#"+currentEmail).val("");

    }
    $("#counter").text(end);
    if(start >= 6){
        $("#additional3").hide();

    }
    if(start >= 3){
        $("#subtract3").show();

    }

});

$("#subtract3").live("click", function(e) {

    e.preventDefault();

    var end = $("#counter").text(); 
    var increment = "3";
    var start = parseInt(start) - parseInt(increment); 


    for (loopIndex = start; loopIndex <= end; loopIndex++)
    {
        var currentRow = "attendeeRow" + loopIndex;

        var currentName = "attendeeName" + loopIndex;
        var currentTitle = "attendeeTitle" + loopIndex;
        var currentCompany = "attendeeCompany" + loopIndex;
        var currentEmail = "attendeeEmail" + loopIndex;



        $("#"+currentRow).hide();

        $("#"+currentName).val("--");
        $("#"+currentTitle).val("--");
        $("#"+currentCompany).val("--");
        $("#"+currentEmail).val("a@b.c");

    }
    $("#counter").text(start);


    if(start >= 6){
        $("#additional3").hide();

    }
    if(start >= 3){
        $("#subtract3").show();
    }

});
});
  • 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-30T15:07:19+00:00Added an answer on May 30, 2026 at 3:07 pm

    I assume this…

    alert("#"+currentRow);
    $("#currentRow").show();
    

    is meant to be this…

    alert("#" + currentRow);
    $("#" + currentRow).show();
    

    You’re alerting the concatenation, but not doing the concatenation for the DOM selection.

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

Sidebar

Related Questions

I have a table which contains student grades (SAG). I need to show all
I have a table of time-series data of which I need to find all
I have a simple table view which is editable. All I need the user
I have a table in which I need both the values to be primary
Hi I have a table which references itself and I need to be able
I have the following need I have a logging table which logs som leads
I have a table into which new data is frequently inserted. I need to
I need a select from table which does not have column that tells when
I need a query which can do the following operation. I have a table
I need to display a list of dates, which I have in 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.