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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:06:15+00:00 2026-06-01T02:06:15+00:00

I have 15 form elements on my page in the following format: <tr> <td

  • 0

I have 15 form elements on my page in the following format:

<tr>
  <td colspan="3" class="fieldset-table-field-3-span">
     @Html.EditorFor(model => model.ExistingProductId_MappingName_IsFreeText)
  </td>
</tr>

When the checkbox is in the checked state, I would like the next row to be visible:

<tr>
   <td colspan="3" class="fieldset-table-field-3-span">
      @Html.EditorFor(model => model.ExistingProductId_MappingName_FreeText)
   </td>
</tr>

I could write some JS/jQuery to hide the rows and toggle them on click, but wondered if anybody had a solution for toggling the state of the “next control” so I could hook it up to each checkbox in my form thus only having to do this once in order to adhere to DRY.

Here’s the markup from the first couple of rows:

    <table class="fieldset-table" align="center" cellpadding="3">
        <tr>
            <td class="fieldset-table-label">
                <label for="ExistingProductId_MappingName">Existing ID</label>
            </td>
            <td colspan="3" class="fieldset-table-field-3-span">
                <select id="ExistingProductId_MappingName" name="ExistingProductId_MappingName"><option value="">-- Not Mapped --</option>
                <option value="Id">Id</option>
                <option value="Name">Name</option>
                <option value="Cost Price">Cost Price</option>
                <option value="Unit Price">Unit Price</option>
                </select>
                <span class="field-validation-valid" data-valmsg-for="ExistingProductId_MappingName" data-valmsg-replace="true"></span>
            </td>
        </tr>
        <tr>
            <td class="fieldset-table-label">
                &nbsp;
            </td>
            <td colspan="3" class="fieldset-table-field-3-span">
                <input class="check-box" data-val="true" data-val-required="The Free text field is required." id="ExistingProductId_MappingName_IsFreeText" name="ExistingProductId_MappingName_IsFreeText" type="checkbox" value="true" /><input name="ExistingProductId_MappingName_IsFreeText" type="hidden" value="false" />
                <label for="ExistingProductId_MappingName_IsFreeText">Free text</label>
            </td>
        </tr>
        <tr>
            <td class="fieldset-table-label">
                <label for="ExistingProductId_MappingName_FreeText">Text value</label>
            </td>
            <td colspan="3" class="fieldset-table-field-3-span">
                <input class="text-box single-line" id="ExistingProductId_MappingName_FreeText" name="ExistingProductId_MappingName_FreeText" type="text" value="" />
            </td>
        </tr>
  • 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-01T02:06:17+00:00Added an answer on June 1, 2026 at 2:06 am

    Note that the last change() call is to handle when the page is first loaded (i.e. if the checkbox starts unchecked, the next row is hidden.) Not sure if you need that, but I usually end up needing to use it in situations like these.

      $(function(){
        $('input.check-box[type=checkbox]').change(function(){
          $(this).closest('tr').next().toggle($(this).is(':checked'));
        }).change();
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following JavaScript in my HTML page referencing an HTML form on
I have created following function to fill field of a form page, there is
Please help! I have some form elements in a div on a page: <div
I have a form that when submitted successfully generates new elements on the page
I have a base and derived class called Node which form elements of a
I have 2 <h:form> elements following each other (not one within the other) such
I have the following code which sets up some custom form elements on the
I have an html/css page that is supposed to use an html table layout
I have a form that functions as a settings page. When form elements are
I'm trying to execute I have an html form in a page of this

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.