How bad is it to embed JavaScript into the body of HTML?
Posted
by Andrew
on Stack Overflow
See other posts from Stack Overflow
or by Andrew
Published on 2010-05-14T22:04:06Z
Indexed on
2010/05/14
22:14 UTC
Read the original article
Hit count: 170
html
|JavaScript
A team that I am working on has gotten into the habit of using <script>
tags in random places in the body of our HTML pages. For example:
<html>
<head></head>
<body>
<div id="some-div">
<script type="text/javascript">//some javascipt here</script>
</div>
</body>
</html>
I had not seen this before. It seems to work in the few browsers that I've tested. But as far as I know, it's not valid to put script tags in places like this.
Am I wrong? How bad is it that we are putting script tags within div tags like this? Are there any browser compatibility issues I should be aware of?
© Stack Overflow or respective owner