• Resolved zukenstein

    (@zukenstein)


    Collapsible Fieldset.

    Is it possible to put a link at the bottom of an expanded fieldset to collapse it rather than having to scroll back up to the top and click the legend area?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter zukenstein

    (@zukenstein)

    Thanks for that, I really just wanted a piece of text like “Close Section” rather than a button, is that possible?

    Thanks very much

    Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter zukenstein

    (@zukenstein)

    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/

    Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter zukenstein

    (@zukenstein)

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Collapsible Fieldset’ is closed to new replies.