Hello @zukenstein
If there is a button into the fieldset field, and you want to collapse it by pressing the button, simply enter the following piece of code as its onclick event:
jQuery(this).closest('fieldset').find('div:first').hide();
Best regards.
Thanks for that, I really just wanted a piece of text like “Close Section” rather than a button, is that possible?
Thanks very much
Hello @zukenstein
Yes, of course. Please, insert an “HTML Content” field into the fieldset field with a link tag as follows:
<a href="javascript:jQuery(this).closest('fieldset').find('div:first').hide();">Close Section</a>
Best regards.
Ok I have now tried both of these. The text link one doesn’t do anything and the button version will close the fieldset but you are not able to expand it again once closed.
I have set up a page with it on so you can see
https://81b.co.uk/cff-test-page/
Hello @zukenstein
If you have configured the fieldset as collapsible, the correct code would be:
For the button:
jQuery(this).closest('.cff-collapsible').addClass('cff-collapsed');
For the link, its structure would be:
<a href="javascript:void(0);" onclick="jQuery(this).closest('.cff-collapsible').addClass('cff-collapsed');">Close Section</a>
I’m sorry, but if you need an additional custom coding service, you must contact me through my private website: Custom Coding Service
Best regards.
Ok Thanks the button one doesnt seem to work still but the text one does and that was what I wanted so thanks.
Yes if I want further things done Ill contact you through your website. Appreciate what you have done.