Answer the question
In order to leave comments, you need to log in
How to write the correct JavaScript code for the onClick attribute?
Hello everyone)
The situation is this: I'm trying to make a button with a pop-up window using the Shortcodes Ultimate wordpress plugin.
1. At the first step, I make a pop-up window.
2. At the second step, I make a button, when clicked, a popup should appear. When creating a button, you need to fill in the onClick JavaScript code for the onClick attribute . Question: what javascript code to enter there so that a pop-up window appears when clicked?
Thanks in advance for help)
Answer the question
In order to leave comments, you need to log in
I don't know the specifics of WordPress, but in regular HTML you have to put a function call there.
For example <button onclick = "openModal();"></button>
A in js:
var a = document.querySelector('.modal')
var openModal = function () {
a.classList.toogle('open');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question