so, I am making progress on a button that disappears after a certain amount of time after being clicked like so: https://codepen.io/mso122591/pen/qVZYNN
The problem is that this approach uses jquery, which I can't seem to get to work in wordpress.
Here are some resources to get jquery to work in wordpress (I noticed you have to replace the initial $ to Jquery and might need a wp_enqueue_script thing) but I find it kinda confusing.
1.https://codex.wordpress.org/Using_Javascript#JavaScript_in_Posts 2.https://stackoverflow.com/questions/11159860/how-do-i-add-a-simple-jquery-script-to-wordpress 3.https://premium.wpmudev.org/blog/adding-jquery-scripts-wordpress/ 4.https://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/
I have been able to make javascript work in wordpress, so I tried to get the same result using JS,
so I tried to get the same result with JS code: https://codepen.io/mso122591/pen/rYWXJQ
But it also doesn't work in wordpress.
It seems that wordpress is pretty finicky as this works in wordpress:
JavaScript Alert
Try it
function myFunction() { alert("I am an alert box!"); }
And this does not work:
JavaScript Alert
Try it
function myFunction() { alert("I am an alert box!"); } //notice this one has an extra space
Any ideas to get the button to work in wordpress? Am I missing something about how Javascript has to be structured or how to make JQuery work?