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
HTML Articles
Page 79 of 151
How to get the value associated with the http-equiv or name attribute in HTML?
The content attribute in HTML is used to specify the value associated with the http-equiv or name attribute in meta tags. This attribute provides essential metadata information to browsers and search engines about your web page. Syntax Following is the syntax for using the content attribute with the name attribute − Following is the syntax for using the content attribute with the http-equiv attribute − Using Content with Name Attribute The name attribute specifies the type of metadata, while the content attribute provides the actual value. This ...
Read MoreHow to store custom data private to the page or application in HTML?
HTML data-* attributes allow you to store custom data directly within HTML elements. These attributes provide a standardized way to embed application-specific information that can be accessed via JavaScript and CSS without interfering with HTML semantics. The data-* attributes are part of the HTML5 specification and offer a clean alternative to using non-standard attributes or hidden form fields for storing custom data. Any attribute name beginning with data- followed by at least one character is considered a valid data attribute. Syntax Following is the syntax for data-* attributes in HTML − Content The ...
Read MoreExecute a script when the file is unavailable in HTML?
The onemptied attribute in HTML is an event handler that executes JavaScript code when a media element (audio or video) becomes unavailable or empty. This event typically occurs when the media file cannot be loaded, the playlist becomes empty, or the media source is removed during playback. Syntax Following is the syntax for the onemptied attribute − The script parameter contains JavaScript code or a function call that executes when the emptied event is triggered. When the Emptied Event Occurs The emptied event is fired in the following scenarios − ...
Read MoreExecute a script when the media has reached the end of HTML?
The onended attribute in HTML executes a script when media playback reaches its natural end. This event is triggered for and elements when the media finishes playing, allowing you to display messages, suggest related content, or perform other actions. Syntax Following is the syntax for the onended attribute − ... ... The function() represents a JavaScript function that will execute when the media reaches its end. Video Element with onended Example Following example demonstrates the onended attribute with a video element − ...
Read MoreExecute a script at the start of a drag operation in HTML?
The ondragstart attribute in HTML executes a JavaScript function when a user begins dragging an element. This event is the first to fire in the HTML5 drag and drop sequence, allowing you to set up data transfer and configure the drag operation before the element starts moving. Syntax Following is the syntax for the ondragstart attribute − Content The ondragstart attribute accepts a JavaScript function that receives a DragEvent object containing information about the drag operation. How It Works When a drag operation begins, the ondragstart event fires immediately. This is typically ...
Read MoreSet where to send the form-data when a form is submitted in HTML?
In HTML, the action attribute specifies where to send form data when a form is submitted. This attribute defines the URL of the server-side script or page that will process the form data. Additionally, the formaction attribute on individual form controls can override the form's default action for specific buttons. Syntax Following is the syntax for the action attribute on the form element − Following is the syntax for the formaction attribute on input elements − Parameters The action and formaction attributes ...
Read MoreHow to specify which form element a calculation is bound to with HTML?
The HTML tag creates a clickable label for form elements. When a user clicks on the label text, it activates the associated form control as if they clicked directly on it. The for attribute specifies which form element the label is bound to by referencing the element's id attribute. Syntax Following is the syntax for binding a label to a form element − Label Content The for attribute value must exactly match the id attribute value of the target form element. How Label Binding Works When you bind a label ...
Read MoreSet the name of the form the element belongs to in HTML?
The form attribute in HTML allows you to associate form controls with a specific form element, even when those controls are located outside the form's boundaries. This attribute references the id of the target form, enabling flexible form layouts and better organization of form elements. Syntax Following is the syntax for the form attribute − Submit Here, formId is the ID of the target form element that the control should belong to. How the Form Attribute Works The form attribute creates a logical connection between form controls and a form element. ...
Read MoreExecute 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 More