<button>CONFIRM</button>
button {
font-size: 1.5rem;
padding: 0.4em 1em;
}
body {
display: grid;
place-items: center;
min-height: 100dvh;
}
const button = document.querySelector("button")
button.addEventListener("click", () => {
const ok = confirm("확실하시죠? 🤔");
if (ok) {
button.textContent = "확인 ✅";
} else {
button.textContent = "취소 ❌";
}
})
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.