+ 2
addEventListener is not working.Why?
8 Respuestas
+ 8
JS loads before HTML
So JS couldn't find any #addForm element in addEventListener(which returns null)
Use Onload event
//Remove preventDefault();😅😂
https://code.sololearn.com/WdSHu72jocSw/?ref=app
+ 7
https://stackoverflow.com/questions/21338476/addeventlistener-on-form-submit 😅🤷♂️
+ 7
It's not working, shows the same error also on the desktop.
https://www.dropbox.com/s/fnuuhfrjiuwwwsj/Screenshot_20190802-114246.png?dl=0
+ 6
Jaydeep Khatri so the thing is that I have to load JS after loading the HTML document.
+ 5
Jaydeep Khatri I had done this, but it's not working.
+ 5
Ginfio it's not working for me, it throws an error in console. I want to add something in the Dom I was just testing is the function works by printing in the console.
+ 1
Gurpreet J it looks like it's working.
What exactly do i want it to do - on submit, say Hello world?
0
I really don't think this makes it work, (just switched things.)
https://code.sololearn.com/WAz4m6oAdAvZ/?ref=app
I don't know what preventDefault means, you might try removing and adding somethings i guess.
I really don't know y, cuz it works on mine.