How to use DOM Object GetElementByTagNameNs in JavaScript

In this article I am going to explain about DOM Object GetElementByTagNameNS() Method in JavaScript.
  • 3842

JavaScript DOM Object GetElementByTagNameNS() Method

JavaScript getElementByTagNameNS() method use for return multiple element with particular tag name in document and with specified Namespace.


document.getElementByTagName("Url name","Tag Name")

Example // In this example when you will click on button then button text will be display in text form.

<html xmlns="" lang="en" xml:lang="en">


    <script type="text/javascript">

        function myfun() {

            var mm = document.getElementsByTagNameNS("", "button");

            var butText = mm[0].childNodes[0].nodeValue;

            document.getElementById("dmm").innerHTML = butText;





    <h3 id="dmm" style="color: Blue">

        click button for display button text</h3>

    <button onclick="myfun()">

        click me</button>






Before Click button



After click button



You may also want to read these related articles: here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.