0

So I was asking a question on here, got around to implementing the solution, and it doesn't seem to work particularly well - I keep getting the error "content of elements must consiste of well-formed mark-up"

I am using the NetBeans IDE.

It seems to center around the < before len

Here's the code that brings up this error:

function formValidation() {

var ids = ["orgname", "cultpicklist", "catpicklist", "servpicklist"],
    formValue = 1;

for (var i = 0, len = ids.length; i < len; i++) {
    if (document.getElementById(ids[i]).value === "") {
       formValue = 0;
       break;
    }

 if (formValue == 1) {
           return true;
      } else if (formValue == 0) {
           alert('Please fill out all required fields');
           return false;
      }
}
Steven Matthews
  • 9,705
  • 45
  • 126
  • 232

1 Answers1

12

Does this piece of JavaScript happen to live in a <script> tag in an XHTML page? If so, move it to an external JS file, or use a CDATA section in the script tag.

Community
  • 1
  • 1
Matt Ball
  • 354,903
  • 100
  • 647
  • 710