Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
[Note, There are other ways to do these events (others may add those hints)] JavaScript is event-driven; most anything that could describe a "change of state" or user-initiated action causes an event to be generated, which you can (and should plan to) catch. Events you could use here are "on load" and "on click" (where 'click' means "mouse click" or tap) A typical hook: window.onload = function(){ // the DOM is loaded } Or from HTML: <input type=... onclick="somefunc(this)"> You'd then define a recipient function. Note, "this" is a reference to the object having the event.
15th Jan 2019, 5:09 PM
Kirk Schafer
Kirk Schafer - avatar