Clem
Clem

Reputation: 11824

HTML validator returns "document type does not allow element "script" here"

I was playing a little bit with jQuery. I'we done everything ok, and it works fine(i'm trying to make my own plugin) with no bugs. But when i try to validate page using http://validator.w3.org i get 1 error: document type does not allow element "script" here.

I have no idea what have i done wrong. Here is my html(js is not important here i guess):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Admin</title>

    <!-- Load jQuery -->
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/Document-Load.js"></script>

    <link rel="stylesheet" type="text/css" href='css/iG_Style.css' />
</head>
<body>
    <div id="body"></div>
</body>
</html>

Upvotes: 1

Views: 1794

Answers (1)

jayM
jayM

Reputation: 602

I havent problems testing on the w3c validator, for best practices use the script tag before the body as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Admin</title>


    <link rel="stylesheet" type="text/css" href='css/iG_Style.css' />
</head>
<body>
    <div id="body"></div>
  <!-- Load jQuery -->
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/Document-Load.js"></script>

</body>
</html>

This document was successfully checked as XHTML 1.0 Strict!

Upvotes: 1

Related Questions