Html entities must be encoded in alt attribute of an image in HTML page. So
>
In that particular case, you don't have encode special HTML characters in JavaScript.
The W3C validator should not complain about this (just tested it) and the document should validate. If not post your code and I'll update my answer.