<form> define that there will be a form on the webpage<label> defines the label for each input<input> creates input method to interact with the user<textarea> creates an input area in which the user can input free text<button> creates a button that executes a specific action with the formevent, evt, or ekeydown and KeyboardEvent<html>) has a click event associated with it and runs it if it existsclick event handler registered on it for the bubbling phase and runs if sodisplay: flex only works it applied to the parent container
clicksubmitonChangehoveron page loadon mouse overon key releaselet element = document.getElementById('someId');element.addEventListenerclick')function greeting(name) {
console.log(`Hello ${name}`);
}
function processUserInput(callBack) {
let name = prompt('Please enter your name:');
callback(name);
}
processUserInput(greeting);
<article onClick="handleClick"> » No JavaScript in the HTMLelement.onEvent = functionName
button(document.getElementById('button')).onSubmit = handleEvent;let container = document.getElementById('container')container.addEventListener('click', handleClick);
'click' event listener that fires the function handleClick when the container element is clicked in the DOMEx:
`function handleClick(event) {
console.log('click happened');
console.log('event');
}`
event gets information passed to it by addEventListener when the listener is activated since handleClick is the call back function
event is an object that gets passed a series of key: value pairs related to the event<form>for in the <label> tag should match the id of the input it goes withMake the <input> a child of the <label>
<label for="kittenName">Kitten Name</label>
<label>Kitten Name
<input type="text" name="kittenBreed">
</label>
<fieldset> is the equivalent of <section> within a table
<legend> is like a heading for elements within a <fieldset> of a tableUse querySelector to create a variable to hold the form data
let form = document.querySelector('form');
'submit' event form.addEventListener('submit', handleSubmit);
'submit' event
let handleSubmit = function(event) {
event.preventDefault();
// nameKitten comes from the name attribute in HTML
console.log(event.target.nameKitten.value);
}