I'm making a flask application and just stuffed it all into a Visual Studio pyproj file and am just reviewing all the edit suggestions the IDE is proposing. One of them is where I put the <script> tag in the html. The code worked as the browser is very forgiving I know with html, but what exactly did I unwittingly violate?
-
2include it inside body tag.Ousmane D.– Ousmane D.2017-03-29 18:55:14 +00:00Commented Mar 29, 2017 at 18:55
Add a comment
|
2 Answers
It should be inside body tag. So move one line up.
2 Comments
jxramos
Right, I did that to fix it once I realized my typo, and others in my various template files, but I'm more curious what the constraints are surrounding where you can place script tags and stuff. Still pretty noob to web development coming from desktop development.
Justinas
@jxramos Basically to either
<head> or <body>. In <head> - must be direct child (not nested inside any other tag), while in <body> you can place inside other <div> or directly to <body>. You can inspect websites to see how other uses it.Looks like it's a simple matter of malformatted html, by standard/design I'm guessing. According to https://www.w3schools.com/js/js_whereto.asp ...
JavaScript in <head> or <body>
You can place any number of scripts in an HTML document.
Scripts can be placed in the <body>, or in the <head> section of an HTML page, or in both.
