I have been facing a challenge with jQuery while trying to create a div that covers the entire page when clicked. I am aware of how to achieve this effect by using a div with a higher z-index and some opacity. I also have a button, but I'm unsure of how to make it work when clicked. Here is the link to my code on https://jsfiddle.net/4uu8Lkdt/8/. Any assistance would be greatly appreciated. I attempted the following:
$('#id').click(function() {
$('#id').toggleClass('cover');
document.getElementById("cover").style.zIndex = 1;
});
However, this approach did not yield the desired result. As someone new to website development and JavaScript, I would appreciate any guidance.