How to store custom data private to the page or application in HTML?

Yaswanth Varma
Updated on 16-Mar-2026 21:38:53

661 Views

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 More

HTML DOM Input FileUpload required Property

karthikeya Boyini
Updated on 16-Mar-2026 21:38:53

322 Views

The HTML DOM Input FileUpload required property sets or returns whether a file upload field must be filled out before submitting a form. This property reflects the HTML required attribute and is a boolean value that determines form validation behavior. Syntax Following is the syntax for returning the required property − object.required Following is the syntax for setting the required property − object.required = true|false Parameters The required property accepts boolean values − true − The file upload field is required and must be filled before form ... Read More

Execute a script when the file is unavailable in HTML?

Arjun Thakur
Updated on 16-Mar-2026 21:38:53

257 Views

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 More

HTML DOM Input FileUpload Object

karthikeya Boyini
Updated on 16-Mar-2026 21:38:53

470 Views

The HTML DOM Input FileUpload Object represents an element with type="file" in an HTML document. This object provides properties and methods to interact with file upload elements programmatically, allowing developers to create, modify, and access file input controls dynamically. Creating a FileUpload Object You can create a FileUpload object dynamically using JavaScript's createElement() method − Syntax var fileUploadBtn = document.createElement("INPUT"); fileUploadBtn.setAttribute("type", "file"); Alternatively, you can access an existing file input element using − var fileUploadBtn = document.getElementById("fileId"); // or var fileUploadBtn = document.getElementsByTagName("input")[0]; Properties The HTML DOM ... Read More

How to use the formmethod attribute in HTML?

Nancy Den
Updated on 16-Mar-2026 21:38:53

258 Views

The formmethod attribute in HTML is used to override the default HTTP method specified in a form's method attribute. It is used specifically with elements of type submit and image, allowing different submit buttons within the same form to use different HTTP methods (GET or POST). Syntax Following is the syntax for the formmethod attribute − Where method can be either "get" or "post". Parameters The formmethod attribute accepts the following values − get − Appends form data to the URL as query parameters. Data is visible in ... Read More

Execute a script when the media has reached the end of HTML?

Giri Raju
Updated on 16-Mar-2026 21:38:53

192 Views

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 More

HTML DOM Input Email required Property

AmitDiwan
Updated on 16-Mar-2026 21:38:53

215 Views

The HTML DOM Input Email required property determines whether an email input field must be filled out before submitting a form. This property corresponds to the required HTML attribute and provides a way to access and modify the required state of email input elements using JavaScript. Syntax Following is the syntax for getting the required property value − inputEmailObject.required Following is the syntax for setting the required property − inputEmailObject.required = booleanValue Parameters The booleanValue parameter can be one of the following values − Value ... Read More

How to use formtarget attribute in HTML?

Krantik Chavan
Updated on 16-Mar-2026 21:38:53

343 Views

The formtarget attribute in HTML specifies where to display the response after submitting a form. This attribute overrides the target attribute of the element and is used only with and elements. Syntax Following is the syntax for the formtarget attribute − Where value can be _blank, _self, _parent, _top, or a custom frame name. Attribute Values The formtarget attribute accepts the following values − Value Description _blank Response gets displayed in a new window or tab _self The ... Read More

HTML5 Canvas drawings like lines are looking blurry

Yaswanth Varma
Updated on 16-Mar-2026 21:38:53

3K+ Views

HTML5 Canvas drawings often appear blurry due to differences in device pixel ratios and improper coordinate positioning. This occurs because browsers scale canvas content differently across various devices and screen densities, leading to anti-aliasing effects that make lines and shapes appear fuzzy. The primary causes of blurry canvas drawings include − Device Pixel Ratio − Different devices have varying pixel densities, causing the browser to scale canvas content. Half-pixel positioning − Drawing on fractional pixel coordinates forces the browser to use anti-aliasing. Canvas size mismatch − When canvas display size differs from its actual resolution. ... Read More

HTML DOM Input Hidden Object

karthikeya Boyini
Updated on 16-Mar-2026 21:38:53

534 Views

The HTML DOM Input Hidden Object represents an element with type="hidden" in an HTML document. Hidden input fields are invisible to users but store data that gets submitted with forms, making them useful for maintaining state information, tokens, or IDs. Syntax Following is the syntax to create an input hidden object − var hiddenInput = document.createElement("INPUT"); hiddenInput.setAttribute("type", "hidden"); You can also access an existing hidden input element − var hiddenInput = document.getElementById("hiddenFieldId"); Properties Following are the properties of HTML DOM Input Hidden Object − ... Read More

Advertisements