<button class="always">always</button>
<button class="once">once</button>
document.querySelector('.always').addEventListener('click', () => {
  alert('always')
});

document.querySelector('.once').addEventListener('click', () => {
  alert('once')
}, {
  once: true
});
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.