简体   繁体   中英

How to show a div as a popup without any click event in java script?

I want to setup a popup with an event listener rather than using the onclick function. My project is a calender and when I select a day I want it to show a div as pop up.

This question is pretty basic, checkout W3School .

myFunction(){
...
}

var element = document.getElementById("myPopUp");
element.addEventListener("click", myFunction()); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM