How to use Core DOM NodeList item in JavaScript

In this article i am going to explain about nodelist item method in core DOM.
  • 1866

DOM NodeList item method

The item method returns the item at the specified index of the node collection.

Syntax of item method


Browser support

The item method  supported in all major browser.

Parameters in item method

It has only one index parameter.

Example of item method

<!DOCTYPE html>


<body><p id="demo">Click the button to get first child node name </p>


<button onclick="ItemFunction()">Click Me</button>


<script type="text/javascript">

    function ItemFunction() {

        var x = document.getElementById("demo");

        x.innerHTML = document.body.childNodes.item(0).nodeName;






item new method.jpg

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

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.