简体   繁体   English

在javascript中单击按钮时如何显示模态? 我需要一个例子,谢谢

[英]how do you Display a modal when a button is clicked in javascript? i need a example, thanks

how do you Display a modal when a button is clicked in javascript?在javascript中单击按钮时如何显示模态? i need a example, thanks我需要一个例子,谢谢

instead of using alert you will want to look for a modal library like https://micromodal.now.sh/ or build your own.而不是使用警报,您将需要寻找像https://micromodal.now.sh/这样的模态库或构建自己的。

 document.getElementById("myButton").addEventListener("click", function(){ alert("World"); })
 <button id="myButton"> Hello </button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在JavaScript中单击按钮时如何显示列表? - How do I display a list when button is clicked in JavaScript? 单击禁用按钮时如何显示模式? - How do I make a modal appear when the disabled button is clicked? 单击按钮时如何将此 animation class 添加到模态? - How do I add this animation class to a modal when a button is clicked? 单击 javascript 按钮时,如何将数据推送到 firebase? - How do you push data to firebase when a javascript button is clicked? 在香草 javascript 中单击叠加层时如何隐藏模式 - How do I hide a modal when the overlay is clicked in vanilla javascript 单击按钮时如何使用 jquery 显示此 div - How do I display this div using jquery when a button is clicked 使用jQuery单击按钮时,如何显示幻灯片? - How do I display a slideshow when a button is clicked using jQuery? 如何仅在单击按钮时显示元素(例如:slidebar) - how to display an element only when a button is clicked (example: slidebar) 单击按钮时,如何使用带有 onclick 事件的单引号在计算器中显示某个单词? - How do you use single quotes with an onclick event to display a certain word in a calculator when the button is clicked? 单击按钮后,如何将pdf文件加载到模态中? - How do I load my pdf file into my modal when the button is clicked?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM