Element isDefaultNamespace Method - Javascript DOM

Javascript examples for DOM:Element isDefaultNamespace

Description

The isDefaultNamespace() method returns true if the specified namespace is default, otherwise false.

Parameter Values

ParameterType Description
namespaceURI String Required. The URI of the namespace to check

Return Value:

A Boolean, returns true if the namespace is default, otherwise false

The following code shows how to Find out if the defined namespace is the default namespace:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*w  w  w. ja v  a2 s  .  c  o m*/
    var d = document.documentElement;
    var x = d.isDefaultNamespace("http://www.w3.org/1999/xhtml");
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials