How can I put an Eventlistener on a Button inside a form and div Element? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I put an Eventlistener on a Button inside a form and div Element?

at the Moment ja Code is document.getElementById("LoginButton").addEventListener("Click", login); and the Order in my HTML Code is <div id="MainView"> <div id="innerMainView"> <form name="loginName"> <input type="text" size="20" name="Username"> <br> <Button type="button" id="LognButton">Login</Button> </form> </div> </div>

19th Apr 2017, 3:10 PM
Fabian Wolf
Fabian Wolf - avatar
1 Answer
+ 4
Typo in id="LoginButton". Btw i suggest you going through onsubmit event listener of form, for the same purpose you are trying to attach a click listener to button.
19th Apr 2017, 3:36 PM
Ashwani Kumar
Ashwani Kumar - avatar