For my current project, I need visitors to access small pop-up windows for content, but only once a day.
Although I have managed to incorporate part of the script using jQuery, it currently selects only the first div element. How can I modify it to select all specific div elements?
Click here for the code snippet
document.addEventListener("DOMContentLoaded", function() {
var vlz = document.getElementById("vlz");
var ls = localStorage.getItem("vlz");
var data = new Date();
var data_atual = data.valueOf();
var data24 = data.setSeconds(data.getSeconds() + 5);
if (ls < data_atual) {
vlz.style.display = "block";
document.getElementById("clz").onclick = function() {
localStorage.setItem("vlz", data24);
vlz.style.display = "none";
}
}
});
.select {
padding: 10px;
background: #eee;
margin: 10px
}
#vlz {
display: none;
width: 250px;
height: 50px;
background: #555;
}
<div id="vlz" class='select'>
<div class='vlz-shw'>
show
</div>
<div id="clz" class='select'>cose</div>
</div>
<div id="vlz" class='select'>
<div class='vlz-shw'>
show
</div>
<div id="clz" class='select'>cose</div>
</div>
<div id="vlz" class='select'>
<div class='vlz-shw'>
show
</div>
<div id="clz" class='select'>cose</div>
</div>