Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Javascript DOM -document.getElementByTagName( ) Method

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 168
    Comment on it

    In Javascript, this method is used to get the elements of specified tag name.
    Parameter values :
    Parameter : String -> This is required. And you give the tagname of that element you want to get .
    Syntax:

    document.getElementByTagName("name") ;
    

    Example :
    Javascript Code :

    fun count()
    var a = document.getElementByTagName("span") ;
    alert("total span tags are :"+a.length);
    }
    

    Html Code :

    <span>Hello </span>
    <span>Mukesh </span>
    <span>From Meerut </span>
    <button onclick = "count()">count</button> // when you click on this, then function count( ) will call
    

    Output :

    total span tags are : 3
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: