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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:02:56+00:00 2026-05-25T10:02:56+00:00

I have a form with multi-value fieldset with each field wrapper and interior divs

  • 0

I have a form with multi-value fieldset with each field wrapper and interior divs set with id incrementing by 1 number to differentiate the id’s. If the checkbox is checked for the checkbox form item within an individual field set, I need to hide the divs that wrap the form items that follow within that field set. A problem that I’m running into is that the name of the id’s contain a unique value within the middle of the string. Example: “#beginningofIDSting-X-endofStringName”. I can’t change the ID or add classes to the wrappers.

<div id="edit-field-gallery-images-0-ahah-wrapper">
<div id="edit-field-gallery-images-0-data-revise-wrapper" class="form-item">
<label class="option" for="edit-field-gallery-images-0-data-revise">
<input id="edit-field-gallery-images-0-data-revise" 
class="form-checkbox revise-check" 
type="checkbox" checked="checked" 
value="1" name="field_gallery_images[0][data][revise]">
Revise This Description
</label>
</div>

<div id="edit-field-gallery-images-0-data-revisedby-wrapper" class="form-item">
//Stuff in Here
</div>

<div id="edit-field-gallery-images-0-data-revisedon-wrapper" class="form-item">
//Stuff in Here
</div>
</div>//End #edit-field-gallery-images-0-data-revisedby-wrapper

<div id="edit-field-gallery-images-1-ahah-wrapper">
<div id="edit-field-gallery-images-1-data-revise-wrapper" class="form-item">
<label class="option" for="edit-field-gallery-images-1-data-revise">
<input id="edit-field-gallery-images-1-data-revise" 
class="form-checkbox revise-check" 
type="checkbox" checked="checked" 
value="0" name="field_gallery_images[1][data][revise]">
Revise This Description
</label>
</div>
//Stuff in Here
</div>

 <div id="edit-field-gallery-images-1-data-revisedby-wrapper" class="form-item">
<div id="edit-field-gallery-images-1-data-revisedon-wrapper" class="form-item">
//Stuff in Here
</div>
</div>//End #edit-field-gallery-images-1-data-revisedby-wrapper

Here’s my jquery

$("input[type='checkbox'][id$='-data-revise']:checked").each(function(){

    $(this).next("[id$=-data-revisedby-wrapper]").hide();   
    $(this).find("[id$=-data-revisedon-wrapper]").hide();   


 });

I used a comination of jfriend00’s and user625037’s solutions. Here it is:

 $("div[id$=data-revisedby-wrapper]").hide();
  $("div[id$=data-revisedon-wrapper]").hide();

$("input[id^=edit-field-gallery-images]:checked").each(function() {
    var startPos = "edit-field-gallery-images-".length;
    var endPos = this.id.indexOf("-", startPos);
    var id = this.id.substring(startPos, endPos);

        $("div[id$="+id+"-data-revisedby-wrapper]").show();
        $("div[id$="+id+"-data-revisedon-wrapper]").show();



});


$(".revise-check").change(function() {
     if(this.checked) {
    $("#" + this.id + "by-wrapper").fadeIn();
    $("#" + this.id + "on-wrapper").fadeIn();
     }
     else{  
     $("#" + this.id + "by-wrapper").fadeOut();
    $("#" + this.id + "on-wrapper").fadeOut();
         }
});
  • 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-25T10:02:57+00:00Added an answer on May 25, 2026 at 10:02 am

    bind click event for input that have id start with edit-field-gallery-images and extract id from the id of the input object. quick sample code:

    // bind click event for input with id start with edit-field-gallery-images
    $("input[id^=edit-field-gallery-images]").click(function() {
        var startPos = "edit-field-gallery-images-".length;
        var endPos = this.id.indexOf("-", startPos);
        var id = this.id.substring(startPos, endPos);
        if(this.checked) {
            $("#edit-field-gallery-images-" + id + "-ahah-wrapper").show();
        }
        else {
            $("#edit-field-gallery-images-" + id + "-ahah-wrapper").hide();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have a form with the standard multi-select functionality of here are the
I have a multi-step form where the form on Step3 submits to Step4.php. Step4
I have a multi-lingual page where I want to display form validation error in
I have the following multi-select box in a HTML form, where user can select
I have form that displays several keywords (standard set of choice lists that changes
I'm doing a multi step form (form wizard) and I have splitted the form
I have a multi-step form and user can navigate to any page to modify
I have a multi select box in a form. the elements in this select
I have some models and I want to generate a multi-selection form from this
I have the code below to advance through a multi-part form for signup. Need

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.