Javascript DOM HTML Node isDefaultNamespace Method

Introduction

Find out if the defined namespace is the default namespace:

Click the button to find out if the specified namespace is default.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>
<script>
function myFunction() {//w  w  w.  ja va2 s. co  m
  var d = document.documentElement;
  var x = d.isDefaultNamespace("http://www.w3.org/1999/xhtml");
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

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

isDefaultNamespace(namespaceURI);

Parameter Values

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



PreviousNext

Related