locked
Difference between <!-- test1 //--> and <!-- --> RRS feed

  • Question

  • User-1882290921 posted
    These are both valid comments in HTML aren't they?  Is there any difference between the two? 

    <!-- test1  //-->
    <!-- test2  -->
    Thursday, August 4, 2005 2:22 PM

All replies

  • User-837620913 posted
    Yes they are.  You generally see the first one when using JavaScript:

    <code>
    <script type="javascript">
    <!-- This begin HTML comment hides javascript from older browsers
    // javascript code goes here
    // use the // for comments in JavaScript, otherwise the --> would create a JavaScript error
    // -->
    </script>
    </code>

    Thursday, August 4, 2005 2:59 PM