+ 2
2nd Aug 2019, 5:40 AM
Gurpreet Jhamat
Gurpreet Jhamat - avatar
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
2nd Aug 2019, 6:13 AM
Jaydeep Khatri
Jaydeep Khatri - avatar
+ 7
https://stackoverflow.com/questions/21338476/addeventlistener-on-form-submit 😅🤷‍♂️
2nd Aug 2019, 5:44 AM
Jaydeep Khatri
Jaydeep Khatri - avatar
+ 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
2nd Aug 2019, 6:13 AM
Gurpreet Jhamat
Gurpreet Jhamat - avatar
+ 6
Jaydeep Khatri so the thing is that I have to load JS after loading the HTML document.
2nd Aug 2019, 6:38 AM
Gurpreet Jhamat
Gurpreet Jhamat - avatar
+ 5
Jaydeep Khatri I had done this, but it's not working.
2nd Aug 2019, 5:51 AM
Gurpreet Jhamat
Gurpreet Jhamat - avatar
+ 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.
2nd Aug 2019, 5:52 AM
Gurpreet Jhamat
Gurpreet Jhamat - avatar
+ 1
Gurpreet J it looks like it's working. What exactly do i want it to do - on submit, say Hello world?
2nd Aug 2019, 5:50 AM
Ginfio
Ginfio - avatar
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.
2nd Aug 2019, 6:04 AM
Ginfio
Ginfio - avatar