0
Why I can't use addEventListener method
3 odpowiedzi
+ 9
You can, just wrap your JS code tab in a window.onload function.
0
Måx Üñťį
you can try the <dialog> element.
html tab:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<button class="bt">menu</button>
<dialog id="d1">gsbsjxksns</dialog>
</body>
</html>
javascript tab:
window.onload = () => {
const bt =
document.querySelector('.bt');
const d1 =
document.querySelector('#d1');
let toggle = false;
bt.onclick = () => {
toggle = !toggle;
toggle ? d1.show(): d1.close();
}
}