pop up javascript code example
Example 1: javascript pop
var cars = ['mazda', 'honda', 'tesla'];
var telsa=cars.pop(); //cars is now just mazda,honda
Example 2: popup JavaScript code
document.getElementById("open-popup-btn").addEventListener("click",function(){
document.getElementsByClassName("popup")[0].classList.add("active");
});
document.getElementById("dismiss-popup-btn").addEventListener("click",function(){
document.getElementsByClassName("popup")[0].classList.remove("active");
});
Example 3: how to make popup modal in jquery with example
<!-- Modal HTML embedded directly into document -->
<div id="ex1" class="modal">
<p>Thanks for clicking. That felt good.</p>
<a href="#" rel="modal:close">Close</a>
</div>
<!-- Link to open the modal -->
<p><a href="#ex1" rel="modal:open">Open Modal</a></p>
Example 4: js alerts
3 types of JS Alerts
- Information : You can only accept.
- Confirmation: You can accept or decline.
- Prompt : You can accept, decline, and/or sendKeys.