Front End Technology Articles - Page 536 of 860

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

HTML DOM console.assert() Method

AmitDiwan
Updated on 07-Aug-2019 14:26:18

136 Views

The HTML DOM console.assert() method is used to write a message to the console only if the first expression supplied to it is false. These messages are intended for user to see. The expression as well as the displaying message are sent as first and second parameters to the console.assert() method respectively.SyntaxFollowing is the syntax for console.assert() method −console.assert(assertion, msg);Here, assertion is any expression that returns boolean true or false. The msg is a JavaScript string or an object. The assertion should be false to display the msg on console.ExampleLet us see an example for the console.assert() method − ... Read More

HTML DOM ColumnGroup span Property

AmitDiwan
Updated on 07-Aug-2019 14:19:44

112 Views

The HTML DOM ColumnGroup span property is associated with the span attribute of the HTML element. The ColumnGroup span property set or returns the value of the span attribute of a column group. The span attribute is used to define the number of columns a element should span to.SyntaxFollowing is the syntax for −Setting the ColumnGroup span property −columngroupObject.span = numberHere, the number specifies the number of columns the element should span to.ExampleLet us look at an example for the ColumnGroup span property −    table, th, td {       border: 1px ... Read More

HTML DOM ColumnGroup object

AmitDiwan
Updated on 20-Feb-2021 05:48:37

135 Views

The HTML DOM ColumnGroup object is associated with the HTML element. The element is used to apply CSS styles to a specific number of columns or all columns. This gives us a greater control on the columns that are present in a table.PropertiesFollowing is the ColumnGroup property −PropertyDescriptionspanSets or returns the value of the span attribute of a column groupSyntaxFollowing is the syntax for −Creating a ColumnGroup object −var x = document.createElement("COLGROUP");ExampleLet us see an example for the ColumnGroup object −Live Demo    table, th, td {       border: 1px solid black;   ... Read More

HTML DOM Column object

AmitDiwan
Updated on 20-Feb-2021 05:51:55

137 Views

The HTML DOM Column object is associated with the HTML element. The Column object is used to get or set the properties of element. The tag is used only inside a element.PropertiesFollowing is the property for column object −PropertyDescriptionSpanTo set or return the span attribute value of a column.SyntaxFollowing is the syntax for −Creating a Column object −var a = document.createElement("COL");ExampleLet us see an example for the column object −Live Demo    table, th, td {       border: 1px solid blue;    }    #Col1{       background-color:pink;    } ... Read More

HTML DOM Code object

AmitDiwan
Updated on 20-Feb-2021 05:53:21

160 Views

The HTML DOM Code object is associated with the HTML 5 tag. It is used for marking up a piece of code by surrounding it inside the element. The Code object basically represents element.SyntaxFollowing is the syntax for −Creating a code object −var a = document.createElement("CODE");ExampleLet us see an example for the HTML DOM code object −Live Demo Click the below button to create a CODE element with some text CREATE    function createCode() {       var x = document.createElement("CODE");       var t = document.createTextNode("print('HELLO WORLD')");       x.appendChild(t); ... Read More

HTML DOM Clipboard event

AmitDiwan
Updated on 07-Aug-2019 13:38:41

434 Views

The HTML DOM Clipboard event is used to provide information regarding modification of the clipboard. The events can be cut, copy and paste. The Clipboard event can be used to make your site more accessible i.e. giving user information on how the clipboard is being modified.PropertiesFollowing is the property for Clipboard event −PropertyDescriptionclipboardDataTo return an object containing the data affected by the clipboard operation(cut, copy or paste).EventsFollowing are the event types belonging to the Clipboard event −EventDescriptiononcopyThis event fires when the content of an element is copied by the user.OncutThis event fires when the user cuts the content of an ... Read More

HTML DOM cite object

AmitDiwan
Updated on 20-Feb-2021 06:01:28

131 Views

The HTML DOM cite object is associated with the HTML element. The element is used to give reference to a cited creative work and title must be included. It can be painting, book, tv show, movies etc.SyntaxFollowing is the syntax for −Creating a cite object −var x = document.createElement("CITE");ExampleLet us see an example of the HTML DOM cite object −Live Demo Click the below button to create a CITE element. CREATE    function createCite() {       var x = document.createElement("CITE");       var t = document.createTextNode("The Starry night.");       ... Read More

Built-in javascript constructors?

Lokesh Yadav
Updated on 09-Dec-2022 05:43:25

1K+ Views

In this article, we are going to discuss about the Built-in JavaScript constructors with appropriate examples in JavaScript. Javascript has provided some built-in constructors for native objects. These built-in functions include Object(), String(), Boolean(), RegExp(), Number(), Array(), Function(), Date(). Note We cannot include Math object in those built-in constructors because Math is a global object. The 'new' keyword cannot be used with Math. Let’s understand this concept in a better way with the help of examples further in this article. Example 1 This is an example program to illustrate about the inbuilt constructor String(). ... Read More

Advertisements