1

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>
12
  • 7
    That markup works perfectly fine when validating through Direct Input. Are you sure this sample reproduces your problem correctly?
    – Brandon
    Nov 21, 2012 at 19:08
  • 1
    Ditto...it works just fine for me as well.
    – Tim M.
    Nov 21, 2012 at 19:09
  • 2
    "Tritto"...works for me, and I tried direct and file upload.
    – CaffGeek
    Nov 21, 2012 at 19:11
  • 2
    Could your server be attaching some script to the end? Some analytics or advertisement maybe?
    – Alohci
    Nov 21, 2012 at 19:24
  • 1
    Does your script contain the text <script> by any means? Nov 21, 2012 at 19:26

1 Answer 1

1

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.