1

I'm having a little problem to validate a html page with a js script.

i have this js part : " .

var lastPage = this.getNumPages() - 1;

if (this.displayedPage < lastPage)

nextPageLink.css('visibility', 'visible');

Everything works fine but i have 1 error remaining when i try to validate it:

Line 856, Column 30: character is the first character of a delimiter but occurred as data if (this.displayedPage < lastPage)

✉ This message may appear in several cases: You tried to include the "<" character in your page: you should escape it as "<" You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe. Another possibility is that you forgot to close quotes in a previous tag.

Line 856, Column 30: StartTag: invalid element name if (this.displayedPage < lastPage)

I just want a way to replace the < sign with something that works whit my script and will pass the W3C validation.

1
  • Remember that validation isn't as important as you may think. They often want to do some extra footwork that really isn't necessary. I suspect something like that is going on here. Commented Nov 19, 2011 at 22:50

2 Answers 2

2

You need to declare your JavaScript as cdata. The < symbol is interpreted as part of a tag, causing the error.

When is a CDATA section necessary within a script tag?

Sign up to request clarification or add additional context in comments.

Comments

1

You could use <script type="text/javascript" src=""></script> to load your javascript file instead of putting it in your htmle file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.