Found 10483 Articles for Web Development

HTML DOM console.info() Method

AmitDiwan
Updated on 20-Feb-2021 05:46:12

66 Views

The HTML DOM console.info() method is used to write an informational message to the console. This method is useful for debugging and testing purposes. Some browsers e.g: firefox, chrome display a small i icon in blue color for the statements printed using this method.SyntaxFollowing is the syntax for the HTML DOM console.info() method −console.info( message )Here, the message is a required parameter and can be of type string or object. It is displayed in the console.ExampleLet us see an example for the HTML DOM console.info() method −Live Demo console.info() Method Press F12 key to view the message in ... Read More

HTML DOM console.groupEnd() Method

AmitDiwan
Updated on 08-Aug-2019 12:13:03

113 Views

The HTML DOM console.groupEnd() method is used for indicating the end of a message group. It exits the current message group in the console.SyntaxFollwing is the syntax for console.groupEnd() method −console.groupEnd()ExampleLet us see an example for the HTML DOM console.groupEnd() method − console.groupEnd() Method Press F12 key to view the message in the console view. GROUP END GROUP    function groupMessage(){       console.group();       console.log("This message will be inside a group!");       console.log("This message will also be inside a group!");    }    function EndGroup(){       console.groupEnd();     ... Read More

HTML DOM console.groupCollapsed() Method

AmitDiwan
Updated on 08-Aug-2019 12:09:02

106 Views

The HTML DOM console.groupCollapsed() method specifies the beginning of a collapsed message group.SyntaxFollowing is the syntax −console.groupCollapsed(label)Here, label is the label for the group.ExampleLet us look at an example for the console.groupCollapsed() method − console.groupCollapsed() Method Press F12 key to view the message in the console view.

HTML DOM console.group() Method

AmitDiwan
Updated on 13-Aug-2019 09:03:19

134 Views

The HTML DOM console.group() method is used to indicate the start of message group and all messages written after this method will be written inside the message group. This allows making one group for all messages or several groups using the label parameter.SyntaxFollowing is the syntax for the console.group() method −console.group([label])Here, label is an optional parameter. It is of type string and acts as a label for the message group created.ExampleLet us look at an example for the HTML DOM console.group() method − console.group() Method Press F12 key to view the message in the console view. NORMAL GROUP ... Read More

HTML DOM console.error() Method

AmitDiwan
Updated on 08-Aug-2019 11:59:46

132 Views

The HTML DOM console.error() method is used for writing an error message to the console. This method is very useful for testing and debugging purposes.SyntaxFollowing is the syntax for console.error() method −console.error(console.error(message))Here, message is a JavaScript string or an object. It is a required parameter value.ExampleLet us see an example for the HTML DOM console.error() method − console.error() Method Click the below button to write object as error message on the console ERROR    function errMessage(){       var errObj = { Message:"ERROR has been caused", Value:"NEGATIVE"};       console.error(errObj);    } Press F12 ... Read More

HTML DOM console.count() Method

AmitDiwan
Updated on 08-Aug-2019 11:41:38

531 Views

The HTML DOM console.count() method is used to write to console the number of times the console.count() method has been called. You can also supply an optional parameter label to this method. The label can help us in having separate counts of the console.count() method.SyntaxFollowing is the syntax for the console.count() method −console.count( [label] );Here, label is an optional parameter of type string that outputs how many times it has been called with that specified label.ExampleLet us see an example of the console.count() method − console.count() method Press F12 to view the message in the console view. COUNT ... Read More

HTML DOM console.clear() Method

AmitDiwan
Updated on 08-Aug-2019 11:36:22

742 Views

The HTML DOM console.clear() method is used to clear the console. The console.clear() method will also write “Console was cleared” message in the console and clears all the previous console content. This method is fully supported by all the browsers.SyntaxFollowing is the syntax for console.clear() method −console.clear()ExampleLet us see an example for the HTML DOM console.clear() method − JavaScript console.clear() Method Press F12 on the keyboard to see the message on your console console.log("TEXT has been printed on the console!"); Click the below button to clear the console CLEAR    function clearConsole() {       console.clear(); ... Read More

Tag names of body element's children in JavaScript?

Manisha Patil
Updated on 24-Aug-2022 06:52:36

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

Replace a child node with a new node in JavaScript?

Lokesh Yadav
Updated on 09-Dec-2022 05:48:10

3K+ Views

In this article we are going to learn how to replace a chils node with a new node in JavaScript with suitable examples. To replace a child node with a new node, there is an inbuilt method to replace the new node with the old node within a given parent node. The inbuilt methods are – replaceChild(), replaceWith(). The methods replaceChild(), replaceWith() are supported by all modern browsers and also they are features of DOM Level1. To understand this concept better, let’s look into the syntax and usage of replaceChild() and replaceWith() methods in JavaScript. Syntax The syntax for replaceChild() ... Read More

Number of elements a particular tag contains in JavaScript?

Lokesh Yadav
Updated on 09-Dec-2022 05:46:04

1K+ Views

In this article we are going to learn about the number of elements a particular tag contains in JavaScript with suitable examples. There are two possible ways to find the number of elements a particular tag contains in JavaScript. One of the possible way is to use the existing property childElementCount and the other way is to use the length property of JavaScript. To understand better, Let’s look into the examples which achieved the above task by using childElementCount and length property of JavaScript. Using the childElementCount property The childElementProperty will return the number of elements a particular id tag ... Read More

Advertisements