Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Yaswanth Varma
Page 5 of 31
Execute a script when the content of the element is being cut in HTML?
The oncut attribute triggers when the user cuts content from an element. While all HTML elements support the oncut attribute, cutting content is only possible when the element's contenteditable attribute is set to "true" or when dealing with form input elements like and . The oncut event is part of the clipboard events family, along with oncopy and onpaste. It fires when the user performs a cut operation using Ctrl+X, right-click context menu, or programmatically through JavaScript. Syntax Following is the syntax for the oncut attribute − Content The function can be ...
Read MoreExecute a script when the element is being double-clicked in HTML?
The dblclick event is triggered when a pointing device button (such as a mouse) is quickly clicked twice on the same element within a short time period. This event is commonly used to provide alternative actions or shortcuts in web applications, similar to double-clicking files in desktop environments. There are three main ways to implement double-click functionality in HTML − Using the ondblclick attribute directly in HTML elements Assigning the ondblclick property via JavaScript Using the addEventListener() method with the "dblclick" event Syntax Following are the different syntaxes for implementing double-click events − ...
Read MoreHow to specify that an element is not yet relevant in HTML?
The hidden attribute in HTML is a boolean attribute used to specify that an element is not yet relevant or no longer applicable to the current state of the page. When present, browsers should not display the element to users. The hidden attribute serves multiple purposes − hiding content that becomes relevant only after certain conditions are met, removing outdated information from view, or concealing elements until user interactions make them applicable. It provides a semantic way to control element visibility without relying solely on CSS. Syntax Following is the syntax for the hidden attribute − ...
Read MoreHow to specify a unique id for an element in HTML?
The id attribute in HTML specifies a unique identifier for an element. The id value must be unique across the entire HTML document. The id attribute is used to reference elements in CSS stylesheets for styling and in JavaScript for element manipulation and access. Syntax Following is the syntax for using the id attribute − Content Where uniqueValue is a string that uniquely identifies the element within the document. To reference it in CSS, use #uniqueValue, and in JavaScript, use document.getElementById("uniqueValue"). ID Attribute Rules The id attribute follows these important rules − ...
Read MoreExecute a script when the content of the element is being copied in HTML?
The oncopy event in HTML fires when a user copies content from an element. This event is triggered when users copy text from input fields, paragraphs, divs, or even when they copy images. The oncopy event is commonly used with text input elements to detect and respond to copy operations. Syntax The oncopy event can be used in two ways − Using the inline event handler − Content Using the addEventListener() method − element.addEventListener("copy", function); Using Inline Event Handler The oncopy attribute allows you to execute JavaScript code ...
Read MoreCan the HTML5 Canvas element be created from the Canvas constructor?
The HTML5 element can be created in multiple ways − directly in HTML markup or dynamically through JavaScript using DOM methods. While there is no direct "Canvas constructor" in the traditional sense, JavaScript provides methods like createElement() to create canvas elements programmatically. The Canvas API is useful for drawing graphics via JavaScript and the HTML element. It can be applied to animation, game graphics, data visualization, photo editing, and real-time video processing. The Canvas API focuses primarily on 2D graphics, while the WebGL API renders hardware-accelerated 2D and 3D graphics using the same canvas element. Syntax ...
Read MoreWhich HTML5 tags are more appropriate to represent money amount
When displaying money amounts in HTML5, several semantic tags can be used depending on the context and purpose. The choice depends on whether you need machine-readable data, emphasis, styling flexibility, or accessibility features. Available Options for Money Representation Here are the main approaches for representing monetary values in HTML5 − element − Provides both human-readable and machine-readable monetary values using the value attribute. element − For visual emphasis without semantic importance, suitable for highlighting prices in product listings. element − For semantically important amounts like total costs or final prices that need emphasis. ...
Read MoreHow to specify the language of the element's content in HTML?
The lang attribute in HTML specifies the language of an element's content. This attribute helps browsers, search engines, and screen readers understand the language being used, enabling proper text-to-speech pronunciation, spell checking, and search engine optimization. Syntax Following is the syntax for using the lang attribute − Content The language-code is typically a two-letter ISO 639-1 code (like "en" for English, "fr" for French) or a more specific variant (like "en-US" for American English). Common Language Codes Following are some commonly used language codes − en − English fr − ...
Read MoreI need a client side browser database in HTML5. What are my options?
HTML5 provides several client-side storage options for web applications. These technologies allow you to store data directly in the user's browser without requiring a server connection, making your applications faster and more responsive. The main client-side storage options in HTML5 include Local Storage, Session Storage, IndexedDB, and Web SQL Database (deprecated). Each serves different use cases based on data persistence, storage capacity, and complexity requirements. Local Storage Local Storage is the most commonly used client-side storage mechanism. It stores data as key-value pairs and persists data until explicitly cleared by the user or the application. The data ...
Read MoreHow do we set the range that is considered to be of low value in HTML?
The low attribute in HTML defines the range that is considered to be of low value in a gauge. It works exclusively with the element to set the threshold below which values are considered low. The low attribute helps browsers visually indicate when a meter's value falls within the low range, typically by changing the gauge's color or appearance. Note − The low attribute can only be used with the tag. Syntax Following is the syntax for the low attribute − Content Parameters The low attribute accepts the following parameter ...
Read More