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 AmitDiwan
Page 270 of 840
HTML DOM Input Text autocomplete Property
The HTML DOM Input Text autocomplete property controls whether a text input field should have autocomplete functionality enabled or disabled. This property is associated with the autocomplete attribute of an element with type="text". The autocomplete feature allows browsers to automatically fill in text fields based on values the user has entered previously. This improves user experience by reducing typing effort for commonly entered data like names, addresses, and email addresses. Syntax Following is the syntax for setting the autocomplete property − textObject.autocomplete = "on|off" Following is the syntax for getting the autocomplete ...
Read MoreHTML DOM MouseEvent offsetX Property
The HTML DOM MouseEvent offsetX property returns the horizontal (x) coordinate of the mouse pointer relative to the target element when a mouse event is triggered. It represents the distance in pixels from the left edge of the element to the mouse cursor position. Syntax Following is the syntax for accessing the offsetX property − MouseEventObject.offsetX Return Value The offsetX property returns a number representing the horizontal coordinate of the mouse pointer relative to the target element's left edge, measured in pixels. How It Works The offsetX property calculates the mouse ...
Read MoreHow to remove the space between inline/inline-block elements in HTML?
When using inline-block elements in HTML, unwanted whitespace often appears between them due to how browsers render whitespace in the HTML markup. This space comes from line breaks, spaces, and tabs between elements in your HTML code. There are several effective methods to remove this spacing. Understanding the Problem The space between inline-block elements occurs because browsers treat whitespace characters (spaces, tabs, line breaks) in HTML as actual content. When elements are displayed as inline-block, this whitespace becomes visible as gaps between the elements. Example − Inline-block Elements with Space Let us first see how the ...
Read MoreHTML DOM Input Text autofocus Property
The HTML DOM Input Text autofocus property is associated with the HTML element's autofocus attribute. This property sets or returns whether the input text field should automatically receive focus when the page loads. When an input field has autofocus enabled, the browser automatically places the cursor in that field as soon as the page finishes loading, allowing users to start typing immediately without clicking on the field first. Syntax Following is the syntax for setting the autofocus property − textObject.autofocus = true|false Following is the syntax for getting the autofocus property − ...
Read MoreHTML for Attribute
The for attribute of the element is used to create an explicit association between a label and a specific form control element. This attribute improves accessibility and usability by allowing users to click on the label text to focus or activate the associated input element. Syntax Following is the syntax for the for attribute − Label Text Here, elementId is the unique ID of the form control that the label describes. The for attribute value must exactly match the id attribute value of the target element. How the For Attribute Works ...
Read MoreHTML DOM Heading object
The HTML DOM Heading object represents any of the HTML heading elements from to . These objects allow you to create, access, and manipulate heading elements dynamically using JavaScript. You can create new heading elements with createElement() and access existing ones with methods like getElementById(). Syntax Following is the syntax for creating a Heading object − var headingElement = document.createElement("H1"); Following is the syntax for accessing an existing Heading object − var headingElement = document.getElementById("headingId"); Creating Heading Elements The createElement() method can create any heading level from H1 ...
Read MoreHTML DOM Input Number type Property
The HTML DOM Input Number type property is used to retrieve the type attribute value of an input element with type="number". This property is read-only and always returns the string "number" for number input elements. Syntax Following is the syntax to get the type property of a number input element − numberObject.type Return Value The type property returns a string representing the type attribute value. For input elements with type="number", it always returns "number". Example − Getting Input Number Type Following example demonstrates how to retrieve the type property of an ...
Read MoreHTML DOM Input Text defaultValue Property
The HTML DOM Input Text defaultValue property is used for setting or getting the default value of a text field. The defaultValue of an element is the initial value assigned to the value attribute in HTML. The key difference between the value property and defaultValue property is that defaultValue retains the original default value specified in HTML, while the value property changes based on user input in the field. Syntax Following is the syntax to get the defaultValue property − var defaultVal = textObject.defaultValue; Following is the syntax to set the defaultValue property − ...
Read MoreHTML DOM Input Number value Property
The HTML DOM Input Number value property is used to get or set the value of an element with type="number". This property allows you to retrieve the current numeric value entered by the user or programmatically set a default value for the number input field. Syntax Following is the syntax for getting the value property − var value = numberObject.value; Following is the syntax for setting the value property − numberObject.value = number; Here, number is a numeric value or string representation of a number that you want to ...
Read MoreHTML DOM Input Password defaultValue Property
The HTML DOM Input Password defaultValue property sets or retrieves the default value of a password field. The defaultValue represents the original value specified in the HTML value attribute, while the value property reflects the current user input. The defaultValue remains constant even when users type in the field. Syntax Following is the syntax to set the defaultValue property − passwordObject.defaultValue = value Following is the syntax to get the defaultValue property − var defaultVal = passwordObject.defaultValue Parameters The defaultValue property accepts the following parameter − value ...
Read More