Message from JavaScript discussions

June 2019

— Coz there is no value


The console.log runs when the page is loaded, in that moment the input has no value, you need to put value="random text" in the input

— I want to display value what user gives

— Then u can use change event

— When the user make a submit on the form for example?

— You can put a onsubmit="showData()" on the form and then make a function in the js called showData() with the console log

Message permanent page

— Or with a onchange in the input like pengcu said

— Don't use onsubmit / onchange

— AddEventListener is superior

— I didn't knew it, why is superior addEventListener?

— Overwrite handlers ?

— AddEventListener does not overwrite existing event handlers on elements