+ 1

Can anyone tell me why onclick () function doesn't work when I have a function bound to it in an external .js file??

While it worked when I included the .js file code into my html file.

29th Jun 2020, 12:05 PM
Sandarbh Tiwari
Sandarbh Tiwari - avatar
3 Antworten
+ 4
Add a defer keyword when you import the js file. <script defer src="..." >
29th Jun 2020, 12:21 PM
Gordon
Gordon - avatar
+ 1
Probably you have to write your function inside a window.onload function...
29th Jun 2020, 12:18 PM
arieh
+ 1
Let me just try both these methods.... Thanks for your help
29th Jun 2020, 3:42 PM
Sandarbh Tiwari
Sandarbh Tiwari - avatar