Found 9053 Articles for Front End Technology

How to work with addEventListener() method in JavaScript HTML DOM?

Nishtha Thakur
Updated on 23-Jun-2020 12:11:48

278 Views

Use the addEventListener() method to attach an event handler.ExampleYou can try to run the following code to learn how to work with addEventListener() method in JavaScript −           Double click the below button.       Double Click                      document.getElementById("btnid").addEventListener("dblclick", displayEvent);          function displayEvent() {             document.getElementById("pid").innerHTML = Date();          }          

How to set the gap between the columns with JavaScript?

Shubham Vora
Updated on 11-Nov-2022 13:08:42

1K+ Views

In this tutorial, we will learn how to set the gap between the columns with JavaScript. The readability of lengthy paragraphs or articles is improved by dividing them into multiple columns. The text is divided into multiple columns using the ‘column-count’ CSS property. There needs to be a space or gap between the columns to make each column separate from the other. To set the gap between the columns with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Using the style.columnGap property Using the style.setProperty() method Using the style.columnGap Property ... Read More

How to fill columns with JavaScript?

Abhishek
Updated on 31-Oct-2022 11:16:52

500 Views

In this tutorial, we will learn how we can fill columns with JavaScript. Use the columnFill property to fill columns. Fill it as auto to fill sequentially, or balance to equally divide content between columns. The columnFill property is the property that specifies how the columns should be filled, auto, balanced, or in any other manner. Syntax Following is the syntax to set the columnFill property in JavaScript − selectedElement.style.columnFill="value"; Here the selectedElement is the element to which you want to add the columnFill property, while using style is the way of adding any CSS property to an element ... Read More

How to detect a mobile device with JavaScript?

Prince Varshney
Updated on 02-Sep-2023 12:54:48

57K+ Views

In this tutorial, we are going to learn how can we detect a mobile device over which we are working using JavaScript. Approach 1: Using the navigator.userAgent Property To detect a mobile device with JavaScript we are going to use the window navigator object which contains all the information regarding a browser. The property which we will use to detect a mobile device will be the userAgent property which is used to return the user-agent header sent to the server by the browser. The value we receive from this property is the browser name, version, and platform i.e., all the ... Read More

What is the fastest, pure JavaScript, Graph visualization toolkit?

George John
Updated on 30-Jul-2019 22:30:21

80 Views

The fastest and pure JavaScripr Graph visualization toolkit isJavaScript InfoVis Toolkit. With it, you can, Perform Graph manipulation, Create bar graphs, Custom nodes, Implementing NodeTypes Adding subtrees, Drag and drop nodes, etc.

Does it make sense to use HTML comments on blocks of JavaScript?

Sravani Alamanda
Updated on 26-Aug-2022 14:41:42

76 Views

No, it is not recommended to use HTML comments to comment blocks of code. When JavaScript has first released some browsers didn’t have any support to understand the script. So a technique was then needed to hide the script code for older browsers. So that time the HTML comment within the JavaScript block was used to prevent the older browsers from showing the script code as text on the page. This technique was followed in the 1990s. Such browsers do not exist now, which wanted you to use HTML comments in JavaScript. Now all browsers understand the JavaScript blocks, so ... Read More

How to set the font family for text with JavaScript?

Shubham Vora
Updated on 11-Nov-2022 13:00:41

6K+ Views

In this tutorial, we will learn how to set the font family for text with JavaScript. The font-family is a CSS property that specifies a prioritized list containing one or more font family names and generic family names for the text of an HTML element. To set the font-family for text with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Using the style.fontFamily Property Using the style.setProperty Method Using the style.fontFamily Property The style.fontFamily property sets a list of font family names and/or generic family names for the text. The ... Read More

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

Shubham Vora
Updated on 09-Nov-2022 11:23:35

122 Views

In this tutorial, we will learn how to set the color of the rule between columns with JavaScript. Multiple columns are used to increase the readability of long paragraphs or articles. The column-count CSS property is used to divide the text into some columns. To set the color of the rule between columns with JavaScript, we used the columnRuleColor property of the style object, which is in the element object of an HTML element. Using the style.columnRuleColor Property In JavaScript, the style.columnRuleColor property of an element is used to set the color of the rule between columns of an element. ... Read More

How to work with Structs in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 09:06:39

7K+ Views

In this tutorial, let us discuss how to work with structs in JavaScript. What is a struct? A struct is the short name of the data structure. The structure creates multiple values of different types in a single variable. We can use a struct to generate records. A struct in JavaScript is the object creation. Other than that, JavaScript does not have a struct feature. Let us see the methods to create a structure. Using the String split() Method Let us learn to create a struct using string split. Separate a string with a comma and whitespace and give it ... Read More

How to create a new img tag with JQuery, with the src and id from a JavaScript object?

Anvi Jain
Updated on 23-Jun-2020 12:06:14

1K+ Views

To create a new img tag in JavaScript, pass an HTML string to the constructor,var myImg = $(''); $(document.createElement(myImg)); myImg.attr('src', responseObject.imgurl);You can also use the following code to create a new img tag with the attributes like src, id, etc −var myImg = $('', {    id: 'id1',    src: exampleimg.png',    alt: 'Alt text' });

Advertisements