You are here: Reference > JavaScript > client-side > HTML DOM > properties > version (html)

version property (html)

Browser support:
Specifies or returns which HTML DTD version governs the current document.
This property is deprecated. Use the doctype element instead.

Syntax:

object.version;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: version

Possible values:

String that sets or retrieves the DTD version information.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the version attribute:
<html version="2.0">
</html>
Did you find this example helpful? yes no

Example HTML code 2:

Recommendation:
<!DOCTYPE html>
<html>
</html>
Did you find this example helpful? yes no

Example HTML code 3:

This example illustrates the use of the version property:
<html id="html" version="2.0">
<head>
    <script type="text/javascript">
        function GetHTMLVersion () {
            var htmlTag = document.getElementById ("html");
            alert (htmlTag.version);
        }
    </script>
</head>
<body>
    <button onclick="GetHTMLVersion ();">Get the version of the HTML document!</button>
</body>
</html>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content