Topic: JS loading issue
vgs pro asked 7 years ago
TypeError: body is null[Weitere Informationen] mdb.js:13861:9 Waves.init https://localhost:444/libs/js/mdb.js:13861:9which leads to
body.addEventListener('mousedown', showEffect, false);and finally
Waves.init = function (options) { var body = document.body;so far, so good. document.body is null, thatswhy the waves method throws an exception (and mouse over waves effects do not work..)... But I am the only one who gets this error? My *.js files are loaded in html head, of course, but obviously the method is called prior the DOM has a body element. Maybe I should put the script tags into END OF body, but thats a very bad design from my point of view. Does anybody else has these problems? Whats your suggestion for this? Thanks
<html> <head> ... <script src="/libs/js/popper.js" type="text/javascript"></script> <script src="/libs/js/jquery-3.2.1.js" type="text/javascript"></script> <script src="/libs/js/bootstrap.js" type="text/javascript"></script> <script src="/libs/js/mdb.js" type="text/javascript"></script> </head> <body> ... </body> </html>
vgs pro answered 7 years ago
Bartłomiej Malanowski staff commented 7 years ago
Thanks for the suggestion! I added this to our ideas listFREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: Yes
- Provided link: Yes
Bartłomiej Malanowski staff commented 7 years ago
Try to put your js files to the end of body and let me know if problem persists