How to hide or show elements with a button click in Elementor

In this tutorial, I will show you how to hide or show elements with a button click in WordPress using Elementor free version.

If you want to keep an element or section hidden and display it with a button click, you can do it easily with the following piece of code.
For more details, please watch this video tutorial.

Code Here: 👇

[sociallocker id=”3541″]

HTML Code:
<button onclick="myFunction()">Click Me</button>

CSS Code:
#SoftExpert{
	display: none;
}

Js Code:
function myFunction() {
  var x = document.getElementById("SoftExpert");
  if (x.style.display === "none") {
    x.style.display = "block";
  } else {
    x.style.display = "none";
  }
}

[/sociallocker]

Leave a Reply