Reputation: 35
So, I've basically got this page, and when I run it through the W3C Validator, it's not validating. Does anyone know why?
Thank you!
Upvotes: 1
Views: 222
Reputation: 82986
Really just expanding on MicronXD's answer. The character immediately following the <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
text but before the line break is U+200C ZERO WIDTH NON-JOINER. (I needed a hex editor to see this).
To an HTML5 parser, this is a normal text character, so it assumes that the head
element has finished and the body
element has started (remember that the end head and start body tags are both optional) so it infers these tags, creates the body element and adds the stray character to that.
Then the validator parser sees the end head tag and the start body tag and reports them as errors because the parser is already in the "In body" state.
To get rid of the stray character, just select and delete the characters between the two script lines including the >
at the end of the first script line and the <
at the start of the second script line, then retype the characters you need.
Upvotes: 2
Reputation: 2220
It was your jquery include. Possibly some sort of encoding issue. It happens occasionally when copying code (like a script block) from another site. I think OSX preserves the original encoding while windows converts clipboard text to some standard encoding. Anyways, this works. I simply copied the second script tag, pasted it, changed the src value, and removed the one you copied from some place else. http://jsfiddle.net/BcrW9/2/
PS -- Please confirm or deny your use of OSX in a comment. This happens to me in OSX all the time. Never had this problem in Windows.
Upvotes: 3