setting a callback

PHOTO EMBED

Mon Mar 29 2021 16:16:03 GMT+0000 (Coordinated Universal Time)

Saved by @captm #javascript

const button = document.querySelector('#click-me');
button.addEventListener('click', (event) => {
  // Callback
  event.currentTarget.innerText = 'Hold still...';
  event.currentTarget.setAttribute("disabled", "");
});
content_copyCOPY

The callback runs when the user triggers the DOM event No need for a value for disabled attribute.

https://kitt.lewagon.com/karr/karr.kitt/lectures/front/http-and-ajax/index.html?title