Reputation: 21513
I'm getting an error TypeError: document.body is null
in javascript.
And the solution is found here.
But the problem is that how can I load the specific javascript file(where the error come from) after <body>
? Or just add a window.onload = function()
to this file?
and especially, how to tell the path of the javascript file to the app?
I only know how to include every file into the application.js
, which would trigger before the <body>
load
Upvotes: 0
Views: 1668
Reputation: 3467
Since you mention application.js
I assume you're using Rails? In that case, use javascript_include_tag
to include your file in the application.html.erb
just before the closing </body>
tag.
Upvotes: 1