Javascript Articles - Page 562 of 671

Which is the best JavaScript compressor?

Nitya Raut
Updated on 23-Jun-2020 12:24:06

229 Views

Here are some of the best JavaScript compressors available −Google Closure CompilerThe Google Closure compiler runs JavaScript quickly and used for a superior JavaScript. It parses your JavaScript, analyzes it, removes dead code, rewrites, and minimizes what's left.JSMinIf you want to minify, then use the JSMin to remove unnecessary comments.YUI CompressorThe YUI Compressor is used to minify the JavaScript files fastly and is secure.

Difference between window.location.href, window.location.replace and window.location.assign in JavaScript?

Arjun Thakur
Updated on 23-Jun-2020 12:14:47

651 Views

The window object includes the location object in JavaScript. It includes the following properties −window.location.hrefIt returns the URL of the current page.Example           Click below to get the complete URL of the page.       URL                function display() {             var res = location.href;             document.write(res);          }           window.location.replaceIt is used to replace the current document.Example           Replace current document                function display() {             location.replace("https://www.qries.com")          }           window.location.assignIf you want to load a new document, use JavaScript assign.Example           Open new document                function display() {             location.assign("https://www.qries.com")          }          

Set how many columns an element should span across with JavaScript.

Shubham Vora
Updated on 31-Oct-2022 11:55:27

366 Views

In this tutorial, we will learn to set how many columns an element should span across with JavaScript. Dividing long paragraphs or articles into many columns improves their readability. The ‘column-count’ CSS property divides the text into numerous columns. Set the columnSpan property to all if you want the columns to span across in JavaScript. To set how many columns an element should span across with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Set the columnSpan property Use the style.setProperty method Set the columnSpan Property In JavaScript, the columnSpan ... Read More

How to set column width and column count with JavaScript?

Vikyath Ram
Updated on 23-Jun-2020 12:16:55

763 Views

To set the column width and column count in a single declaration, use the JavaScript columns property.ExampleYou can try to run the following code to set column width and column count with JavaScript −                    #myID {             column-count: 4;             column-rule: 4px solid yellow;          }                     Click below to change the column count to 2 and minimum size       Change Column count and ... Read More

How to set the width of the rule between columns with JavaScript?

Monica Mona
Updated on 23-Jun-2020 12:18:22

115 Views

Use the columnRuleWidth property to set the width between columns. You can try to run the following code to set the width of the rule between columns with JavaScript −ExampleLive Demo                    #myID {             column-count: 4;             column-rule: 4px solid yellow;          }                     Click below to change width       Change Width between Columns                This is ... Read More

How to set fontStyle, fontVariant, fontWeight, fontSize, lineHeight, and fontFamily in one declaration with JavaScript?

Sharon Christine
Updated on 23-Jun-2020 12:08:47

126 Views

To set all the font properties, use the JavaScript font property. You can try to run the following code to set all font properties in a single declaration with JavaScript −ExampleLive Demo           Heading 1                This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.             Set Font                function display() {             document.getElementById("myID").style.font = "italic 15px verdana,sans-serif";          }          

How to define the number of nodes in a node list with JavaScript HTML DOM?

Prince Varshney
Updated on 06-Dec-2022 09:21:12

536 Views

In this tutorial, we are going to learn how can we find the number of nodes present in a node list in JavaScript. To perform the specific operation, we need to use the HTML DOM which helps us to work with the object model of the webpage. Now let us first understand what a node is and what is a node list in HTML. Everything in an HTML document including element, text, attribute as well as the whole document is a node. Every small element present in an HTML document is part of the navigation tree of an HTML DOM. ... Read More

How to set the style of the rule between columns with JavaScript?

Fendadis John
Updated on 23-Jun-2020 12:19:00

135 Views

Use the columnRuleStyle property to set the style of the rule. You can try to run the following code to set the style of the rule between columns with JavaScript −ExampleLive Demo                    #myID {             column-count: 4;             column-rule: 4px dotted yellow;          }                     Click below to change style       Change Style between Columns                This ... Read More

How to set the column rule properties with JavaScript?

Samual Sam
Updated on 23-Jun-2020 12:10:04

213 Views

The columnRule property is used in JavaScript to set the column rule. It allows you to set the style, color, and width between column rule.ExampleYou can try to run the following code to set the column rule properties with JavaScript −Live Demo           Click below to create 4 columns       Columns                This is demo text. This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text. This is ... Read More

How to add an event handler to an element in JavaScript HTML DOM?

Saurabh Jaiswal
Updated on 22-Aug-2022 08:00:39

2K+ Views

This tutorial will teach how to add an event handler to an element in JavaScript. There are two ways to add an event handler to any element, the first is using the addEventListener method and another is using the event attributes. Using the addEventListener() Method The addEventListener() method is used to attach an event handler to any DOM element. The syntax of this method is following. Syntax element.addEventListener( event, function, capture ) Parameter Event − The name of the event you want to apply on the element e.g. click, mouseover, submit, etc. Function − The callback function which ... Read More

Advertisements