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.
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?