1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Rep Power

    Character "<" is the first character of a delimiter but occurred as data

    Why do I get html error in sJavascript code?
    javascript Code:
      var newQty = +($("#qty_adults").val()) - 1;
      if(newQty < 1)newQty = 1;

     Line 75, Column 13: character "<" is the first character of a delimiter but occurred as data
      if(newQty < 1)newQty = 1;
    This message may appear in several cases:
        You tried to include the "<" character in your page: you should escape it as "&lt;"
        You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
        Another possibility is that you forgot to close quotes in a previous tag.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Rep Power

    when using XHTML, you can't have a < within inline JavaScript code, because it's always expected to mark the beginning of an HTML tag. This is different from plain HTML, which treats the content of script elements specially.

    There are several solutions: (in this order)

    1. Don't use inline JavaScript
    2. Wrap every inline JavaScript code in a CDATA section
    3. Don't use XHTML

IMN logo majestic logo threadwatch logo seochat tools logo