Although it may seem to be obvious for experienced web page authors, it was a discovery for me: XHTML does not understand special symbols “&” and “<” if written directly. So it’s impossible for example to perform “and” operation (&&) in javascript on the page.

There are two solutions for that:

1) Use CDATA for such sections of data, f.e.

  1. <script type="text/javascript">
  2.   //<![CDATA[
  3.      function enableDisableRegisterButton(element1, element2) {
  4.         registerButtonWrapper.disabled = !(element1.checked && element2.checked);
  5. ...
  6.      }
  7.   ]]>
  8. </script>


or 2) Use escaped HTML sequences

  1. & : &amp;
  2. > : &lt;

Email this Share this on Facebook Share this on LinkedIn Tweet This! RSS feed for comments on this post. TrackBack URL

Leave a comment