- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 9053 Articles for Front End Technology
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(); }
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
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
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
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
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
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
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
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' });
To Continue Learning Please Login
Login with Google