Coggle requires JavaScript to display documents.
event
document .querySelector(".findOutMore") .addEventListener("click", event => console.log(event));
> PointerEvent {isTrusted: true, pointerId: 1, width: 1, height: 1, pressure: 0, …}
addEventListener
const helloBtn = document.querySelector('#hello'); helloBtn.addEventListener('click', () => console.log('hello'))
this
function changeColour() { this.style.backgroundColour = makeRandColor(); }
button.addEventListener('click', changeColor)
h1.addEventListener('click', changeColor)
action
preventDefault()
const tweetForm = document.querySelector('#tweetForm'); tweetForm.addEventListener('submit', function (e) { e.preventDefault(); ...
tweetform
<form>
const usernameInput = tweetForm.elements.username; const tweetInput = tweetForm.elements.tweet;
name
input