T.T.T.
T.T.T.

Reputation: 34633

What does this JavaScript error mean?

Using the “Venkman” JavaScript debugger for Mozilla and getting the following error:

 XML Parsing Error: not well-formed
    Location: x-jsd:source?location=http%3A%2F%2F192.168.1.150%2Fscript.js&instance=337
    Line Number 557, Column 50:<line><margin x='t'> - </margin><num>  554</num> ��      valid = false;</line>

Functions works but I don't understand the error.
Any help is appreciated. Thanks.

function ValidateCheckBoxes() 
{
   var valid;
   $(document).ready(function(){

      if($('input[@name=boxesA]:checked').size() == 0)
      {
         valid = false; 
      }
      else
      {
         valid = true;
      }
   });

   return valid;      
}

Upvotes: 0

Views: 417

Answers (2)

PatrikAkerstrand
PatrikAkerstrand

Reputation: 45731

You probably have some weird character encoding of a line break or similar, judging from �� valid = false;. Check the file encoding, remove any white-space before that line, and create a new line break.

Edit: Sorry for the almost identical answer as @Sean Vieira made, was also checking the function with JsLint, and it came out (pretty much) without complaints, but suggested that you use === instead of == when comparing to 0

Upvotes: 2

Sean Vieira
Sean Vieira

Reputation: 160073

I'd say that you've encountered a bug in the “Venkman” JavaScript debugger ... you have some character in your code that is not in the same codepage as the rest of your script. ( �� valid=false; )

When Venkman tries to format your javascript to display it, whatever it is using to parse the XML it generates throws an error, and that's what you are seeing.

Try taking that line out with whatever editor you are using and re-writing it. That should solve the problem.

Upvotes: 3

Related Questions