views:

78

answers:

2

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;      
}
+3  A: 

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.

Sean Vieira
I agree. You should check with some editor the hidden characters in you file.
Ivo Sabev
re-wrote the same thing, seems to work now. Thanks.
Tommy
+2  A: 

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

PatrikAkerstrand
thanks, that worked.
Tommy