
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

703 Views
A string representation of the given node's name is returned by the nodeName property. When a node has attributes, it produces a string with the name of the corresponding attribute. When a node is an element, it returns a string with the name of the tag. This property can only be read. Each element on a webpage can be accessed through a node, which is a component of the DOM tree. Every node is an object with a number of methods and properties; this is why nodes are sometimes known to as node objects. The browser builds a tree ... Read More

759 Views
In this article we are going to learn about the first and last child node of a specific node in JavaScript along with suitable examples. To get the first and last child node of a specific node, there are existing properties called firstChild, lastChild, firstElementChild and lastElementChild. The difference between the property of firstChild and firstElementChild is that in contrast to firstElementChild, firstChild treats both text and comments contained within html elements as children. The firstChild also considers the whitespace in the text. The same is applicable for lastChild and lastElementChild. To get the first child of a list The ... Read More

5K+ Views
In this article we are going to discuss how to remove the child node of a specific element in JavaScript with appropriate examples. To remove the child node of a specific element, there is an existing method in JavaScript called removeChild(). The removeChild() method is different from the remove() method. The remove() method helps us to remove itself. Whereas, with the help of the removeChild() method, we can remove the child node from the parent node. Now, let’s look into the syntax and usage of removeChild() property. Syntax The syntax for removeChild() method is − removeChild(childNode); Where, childNode is ... Read More

6K+ Views
In this article, we are going to learn about the sibling of a list element in JavaScript with suitable examples. To find the sibling of a list element in JavaScript, there is an existing property called nextSibling. The nextSibling property returns the next node on the same tree level. The nextSibling returns a node object and it is a read-only property. Note − The nextSibling propery returns the next sibling node: An element node, a comment node, a text node. The whitespaces in between the elements are also considered as text nodes. Now, Let’s look into the syntax and usage ... Read More

791 Views
In this article, we are going to learn how to insert a node as a chils before an existing chilin JavaScript with appropriate examples. The Javascript has provided insertBefore() method to insert a node as a child before another child. If there are 2 lists we can shuffle the elements between them based on our requirement using the method insertBefore(). Let’s understand this concept better with the help of examples further in this article. Syntax The syntax to insert a node as a child before an existing child in JavaScript for insertBefore method is − insertBefore(newNode, refNode); Where, ... Read More

2K+ Views
The given task to perform in this article is to insert a specified element in a specified position in JavaScript. The Javascript has provided "insertAdjacentElement()" to insert an already existing element in a specified position. There are four specified legal positions. The first position is ‘afterbegin’ (After the beginning of the element (first child)), the second is ‘afterend’ (After the element), third is ‘beforebegin’ (Before the element) and the fourth legal position is ‘beforeend’ (Before the end of the element (last child)). If there are multiple elements with the same name, then use indexes to access them as we access ... Read More

953 Views
In this article, we are going to learn how to insert a specified HTML text into a specified position in the JavaScript document with suitable examples. There is an existing method in the JavaScript to insert a specified HTML text into a specified position in the JavaScript document i.e. insertAdjacentHTML() method. There are four specified legal positions. The first position is ‘afterbegin’, the second is ‘afterend’, third is ‘beforebegin’ and the fourth legal position is ‘beforeend’. Let’s use the above discussed specified legal postions in the examples below. Syntax The syntax to insert a specified HTML text into a specified ... Read More

387 Views
Javascript has provided the getAttributeNode() method to find the attribute node with the specified name of an element, as an attribute object. If the attribute does not exist, the return value is null or an empty string ("").syntaxelement.getAttributeNode(attributename);It returns the attribute object representing the specified attribute node ExampleIn the following example, there are two heading tags with different classes. Those tags when accessed by the getAttributeNode() can return the attribute class with which they attached. It works the same as an array. We can access the multiple classes only by providing their index numbers.Live Demo Tutorix Tutorialspoint var elmnt ... Read More

10K+ Views
In this article, we are going to discuss about an element inside another element in JavaScript with suitable examples. In JavaScript to access an element within another element i.e.., the inner element, we use ‘.’ property. We can also check whether an element is present within another element or not using contains() method. This method either returns true or false. Let’s look into the possible ways to check an element inside another element with appropriate examples further in this article. Syntax The syntax to access an element inside another element is − document.getElementById(‘IDname’).getElementsByTagName(‘Tag’)[i].innerHTML; Where, IDname is the name ... Read More

435 Views
A property of an element called "children" delivers all child elements of the element as objects. We will learn how to use Javascript to obtain the child element of the parent in this tutorial. The challenge is to use JavaScript to choose a certain element in an HTML document and retrieve all of the parent element's children. There are 2 methods for doing this to obtain the child element − making use of the children property making use of the querySelector Method Through the use of examples, we will discuss both strategies and understand how they are applied. ... Read More