Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element 'script' cannot be nested inside element html

Tags:

html

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?

script inside html tags

like image 890
jxramos Avatar asked Mar 29 '17 18:03

jxramos


2 Answers

It should be inside body tag. So move one line up.

like image 182
Justinas Avatar answered Nov 18 '22 04:11

Justinas


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.

like image 43
jxramos Avatar answered Nov 18 '22 04:11

jxramos