Professional Web Design & Development

Need help with a project? We provide custom design and development services including WordPress & Drupal CMS, Magento Commerce Solutions and Mobile application development.

Request Quote

Make your JavaScript to be XHTML compliant

Everyone is now upgrading their HTML to XHTML on web. It is important to make your webpages XHTML compliant. We have enlisted 2 methods to update your older pages into DHTML or JavaScript XHTML compliant.

Option 1: For inline JavaScript, you must wrap the code itself in the CDATA tag along with some clever use of JavaScript comments to let the validator know the content within the script should not be parsed for XHTML validation.

<script type="text/javascript">
//<![CDATA[
//The JavaScript code itself
//The JavaScript code itself
// etc...
//]]>
</script>

Option 2: The alternative and most popularly used method for making your JavaScript XHTML compliant is to remove the entire complicated script from your page, and place its contents inside an external JavaScript file, then reference this file on your web page.

<script type="text/javascript" src="myscript.js">
//Comment here
//Comment here
</script>

You might also like:

  1. CSS Pagination Links
  2. Silicon WordPress Theme
  3. Accord WordPress Theme
  4. Simplified WordPress Theme
  5. Twilight WordPress theme

Tags: ,

Leave a Reply