1. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Next Door
    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
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo