Conditionally applying css styling by clicking button

Hi,
I have a css style, e.g.

.custom-directory-search {
display: none !important;
}

that is applied to content within a

element, e.g.
, which I would like to be able to conditionally apply, by toggling the style on or off on clicking a button.

I’d be very grateful for any assistance. Thanks.

Hi Cathal,

Thanks for reaching out.

Toggling the style on/off on clicking a button would require some JS code.

Here are some helpful resources for you:
https://www.w3schools.com/jquery/eff_toggle.asp
https://www.w3schools.com/jquery/event_toggle.asp
https://www.protechtraining.com/blog/post/jquery-code-example-how-to-do-a-hideshow-toggle-button-188

Hope that helps.

Thank you.

Thank you!

Hi Cathal,

You are most welcome.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.