Forums

script tag in <head> vs <body>

i have a javascript function that isn't found if it's in the head tag. the onclick event calls the function and an error is thrown saying the function is undefined. then if i move the script tag with the function into the body, right above the element that calls the function, it works. why would this be? it doesn't happen locally with the flask dev server.

Clyde

I would guess it works on the local dev server because you have different security settings on your browser for accessing local webservers. But I could be completely wrong.