I’m using elementor for my wordpress site and I wish to have a button in a first div (section) that control if a second and separate div (section) is display or not. I’ve tried to use the checkbox hack but it’s working only if the checkbox is in the div as the content https://css-tricks.com/the-checkbox-hack/
Is there a solution to use CSS or even javascript ? If you advice to me to use javascript I’ll put in my function.php file and as I’m begginer in javascript can you please write all the function I have to implement into my function.php file.
Basically it means :
<div>button</div> <div>content to show and hide on click on the button</div>
Best regards,
Clément
3
Answers
Thanks for all of yours answers! Here what I use:
Best regards, Clément
You can use Jquery:
1-Put an id to your DIV
2-Call jquery to display it
And jquery you can call it with CDN
In javascript without any library this could be very easy but you need to put an id on your divand your button.
Then you just add a script section like this : (it just need to be after your div and your button in the DOM)
And at last, you need a css like this: