Logo
  Tuesday, September 02, 2014
Sign-In  |  Sign-Up  |  Contact Us  | Bookmark |  RSS Feed

HTML5 Tutorial FeedBurner

The HTML5 <!--…--> Comment Tag  
The HTML5 <!--…--> tag is mainly utilized for adding comment in the source code. However, do not expect the comment to appear on the web browser. Utilizing the HTML5 <!--…--> tag is important for adding comments which will serve as notes regarding your code. That way, if alterations have to be done in the future, it is useful as a reference. When there are multiple source codes, this tag will avoid confusion.

Another way to use the HTML5 <!--…--> tag is to be able to hide the scripts in browsers that do recognize it. It is a tag that would avoid showing the script as a plain text.

When used for scripts, it is necessary to add // at the end of the comment. The // is a comment symbol in JavaScript. It would look like this:

<script type="text/javascript">

<!--

function displayMsg()

{

alert("Comment should be placed here!")

}

//-->

</script>

Adding the // is necessary so that JavaScript would not interpret it as the --> tag.

The HTML5 <!--…--> tag is compatible with the different main browsers that are being utilized these days like Internet Explore, Firefox, Opera, Safari and Google Chrome.

Using the <!--…--> tag is the same for both HTML5 and HTML4.01. This tag does not support the Global Attributes and Event Attributes.

Print HTML5 <!--…--> Comment Tag Bookmark HTML5 <!--…--> Comment Tag

Related Articles  
The HTML5 <iframe> Tag
There are times when inserting or embedding another document within an HTML document is necessary. During such ...
The HTML <datalist> Tag
If you see forms online which already have drop down options, the tool used for creating those is the HTML ...
The HTML5 <option> Tag
The purpose of adding HTML5 <option> tag is to indicate option within a list selected by the author. The HTML5 ...
The HTML5 <select> Tag
The HTML5 <select> tag is primarily used in creating a drop down list within an HTML document. This drop down ...
The HTML5 <source> Tag
The <source> tag is applicable for media sources that have to work along with the media elements. For authors who ...
The HTML5 <!DOCTYPE> Declaration
The important thing about using the HTML5 <!DOCTYPE> Declaration is that it should be the first information that ...
More