Title: hide/show toggle affecting all fields
Last modified: December 13, 2021

---

# hide/show toggle affecting all fields

 *  Resolved [itexilion](https://wordpress.org/support/users/itexilion/)
 * (@itexilion)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/)
 * Hello, working on next feature to show/hide description in .comment_area,
    There
   is a fieldset-fieldname1 with .comment_area-fieldname2 (custom class hidedesc)
   which is hidden on document load and button-fieldname3 with code jQuery(‘.comment_area’).
   closest(‘.hidedesc’).toggle()
 * The fieldset-fieldname1 is duplicated multiple times and on button press it shows.
   comment_area in all fieldsets, i need to modify it to show .comment_area only
   in related fieldset.
 * Could you please guide me what is wrong?)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/#post-15157556)
 * Hello [@itexilion](https://wordpress.org/support/users/itexilion/)
 * You can assign a custom class name to every fieldset field. Ex. `fieldset-a`,`
   fieldset-b`, `fieldset-c`, and so on.
 * Now, the onclick event of the button that displays the first comment_area field
   would be:
 * `jQuery('.fieldset-a .hidedesc').show();`
 * But if you want to hide the other `hidedesc` fields except the correct one, the
   code would be:
 * `jQuery('.hidedesc').hide(); jQuery('.fieldset-a .hidedesc').show();`
 * I’m hiding all `hidedesc` first, and then I’m displaying the correct one.
 * And the same for the other buttons:
 * `jQuery('.hidedesc').hide(); jQuery('.fieldset-b .hidedesc').show();`
 * `jQuery('.hidedesc').hide(); jQuery('.fieldset-c .hidedesc').show();`
 * …
 * Best regards.
 *  Thread Starter [itexilion](https://wordpress.org/support/users/itexilion/)
 * (@itexilion)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/#post-15157658)
 * That’s what i’m trying to avoid, to much work if there plenty of fieldsets,
    
   find another solution `jQuery(this).parent().siblings('.hidedesc').toggle()`
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/#post-15157672)
 * Hello [@itexilion](https://wordpress.org/support/users/itexilion/)
 * I’m sorry, but I cannot tell you if your code is correct or not without checking
   your form’s structure. I don’t know if the parent of the button includes a sibling
   with the class name `hidedesc`
 * Please, send me the link to the form to check its structure.
 * Best regards.
 *  Thread Starter [itexilion](https://wordpress.org/support/users/itexilion/)
 * (@itexilion)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/#post-15158095)
 * Hi, no I actually posted a code that works for me) Just if somebody will look
   for similar thing it will be the hint)
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/#post-15158386)
 * Hello [@itexilion](https://wordpress.org/support/users/itexilion/)
 * My apologies for the confusion, and thank you so much for sharing your solution.
 * Best regards.
 *  Thread Starter [itexilion](https://wordpress.org/support/users/itexilion/)
 * (@itexilion)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/#post-15159000)
 * It’s ok)
    -  This reply was modified 4 years, 5 months ago by [itexilion](https://wordpress.org/support/users/itexilion/).

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘hide/show toggle affecting all fields’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [itexilion](https://wordpress.org/support/users/itexilion/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/hide-show-toggle-affecting-all-fields/#post-15159000)
 * Status: resolved