You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constform=document.querySelector("form");consttextarea=document.querySelector("textarea");// Create a new event, allow bubbling, and provide any data you want to pass to the "detail" propertyconsteventAwesome=newCustomEvent("awesome",{bubbles: true,detail: {text: ()=>textarea.value},});// The form element listens for the custom "awesome" event and then consoles the output of the passed text() methodform.addEventListener("awesome",(e)=>console.log(e.detail.text()));// As the user types, the textarea inside the form dispatches/triggers the event to fire, and uses itself as the starting pointtextarea.addEventListener("input",(e)=>e.target.dispatchEvent(eventAwesome));
The text was updated successfully, but these errors were encountered:
https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events
The text was updated successfully, but these errors were encountered: