I have code that starts off with
<%
function selected()
{
at the start of my code and JSLint gives the error
Problem at line 1 character 1: Expected ‘%’ and instead saw ‘%’.
This code works just fine and has for a long time. I was just trying to run this against JSLint hoping to improve my code. JSLint stops at this error and will not scan the rest of the code.
Problem at line 1 character 1: Stopping. (0% scanned).
I was just hoping someone had an idea why this was wrong. It is production code and won’t be changed but it is always a good idea to learn why something should not be written this way.
Thanks.
Is this a Classic ASP script using JScript rather than traditional Javascript?
If so, I’m not sure JSLint is going to work properly unless you strip out the Classic ASP-specific stuff (
<% %>)