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 Kumar Varma
88 articles
How to use autocomplete attribute in HTML?
The HTML autocomplete attribute controls whether browsers should automatically fill in form fields based on previously entered values. When set to on, the browser provides suggestions from the user's input history. When set to off, it disables this functionality for enhanced privacy or security. The autocomplete attribute can be applied to both elements (affecting all contained inputs) and individual elements for granular control. Syntax Following is the syntax for using the autocomplete attribute with form elements − ... Following is the syntax for using the autocomplete attribute with input elements − ...
Read MoreHTML DOM Input Checkbox Object
The HTML DOM Input Checkbox Object represents an HTML input element with type "checkbox". It provides properties and methods to interact with checkbox elements programmatically, allowing you to get or set their state, value, and other attributes through JavaScript. Syntax Following is the syntax to create a checkbox element using JavaScript − var checkboxObject = document.createElement("input"); checkboxObject.type = "checkbox"; To access an existing checkbox element − var checkboxObject = document.getElementById("checkboxId"); // or var checkboxObject = document.getElementsByName("checkboxName")[0]; Properties The Input Checkbox Object has the following properties − ...
Read MoreHTML DOM Input Color autofocus Property
The HTML DOM Input Color autofocus property sets or returns whether a color input field automatically receives focus when the page loads. When set to true, the color input will be highlighted and ready for user interaction immediately upon page load. Syntax Following is the syntax for returning the autofocus property value − inputColorObject.autofocus Following is the syntax for setting the autofocus property − inputColorObject.autofocus = booleanValue Parameters The booleanValue parameter can be one of the following − Value Description true ...
Read MoreHTML DOM Input Color name Property
The HTML DOM Input Color name property gets or sets the value of the name attribute for an input color element. The name attribute is crucial for form submission, as it identifies the color input field when the form data is sent to the server. Syntax Following is the syntax for getting the name property − inputColorObject.name Following is the syntax for setting the name property − inputColorObject.name = "string" Return Value The name property returns a string representing the value of the name attribute of the input color ...
Read MoreHTML DOM Input Color type Property
The HTML DOM Input Color type property returns or sets the value of the type attribute of a color input element. This property allows you to get the current input type or dynamically change it to a different input type such as text, radio, or other valid input types. Syntax Following is the syntax for returning the type value − inputColorObject.type Following is the syntax for setting the type value − inputColorObject.type = stringValue Return Value The property returns a string representing the current type of the input element ...
Read MoreHTML DOM Input Date autofocus Property
The HTML DOM Input Date autofocus property sets or returns whether a date input field should automatically receive focus when the page loads. This property corresponds to the autofocus HTML attribute. Syntax Following is the syntax for getting the autofocus property − inputDateObject.autofocus Following is the syntax for setting the autofocus property − inputDateObject.autofocus = booleanValue Return Value The autofocus property returns a boolean value − true − If the date input has the autofocus attribute set false − If the date input does not have the ...
Read MoreHTML DOM Input Date form Property
The Input Date form property returns a reference to the form element that contains the input date field. This property is read-only and provides access to the enclosing form object, allowing you to retrieve form attributes like ID, action, or method through JavaScript. Syntax Following is the syntax for accessing the form property − inputDateObject.form Return Value The form property returns a reference to the form element that contains the input date field. If the input date is not inside a form, it returns null. Example − Getting Form Reference Following ...
Read MoreHow to return the id of the first image in a document with JavaScript?
To return the id of the first image in a document, use the document.images property in JavaScript. This property returns a collection of all image elements in the document. Syntax document.images[0].id How It Works The document.images collection contains all elements in the document, indexed starting from 0. To get the first image's id, access document.images[0].id. Example Here's a complete example showing how to get the id of the first image: ...
Read MoreHow to preserve the readability of text when font fallback occurs with JavaScript?
The fontSizeAdjust property preserves text readability when font fallback occurs by maintaining consistent apparent size across different fonts. It adjusts the font size based on the aspect ratio (x-height to font-size ratio) to ensure uniform visual appearance. How fontSizeAdjust Works Different fonts have varying x-heights even at the same font-size. When a preferred font fails to load and falls back to another font, the text may appear too large or too small. The fontSizeAdjust property solves this by scaling the fallback font to match the aspect ratio of the preferred font. Syntax element.style.fontSizeAdjust = "value"; ...
Read MoreHow to set the minimum height of an element with JavaScript?
Use the minHeight property in JavaScript to set the minimum height of an element. This property ensures that an element maintains at least the specified height, even if its content is smaller. Syntax element.style.minHeight = "value"; The value can be specified in pixels (px), percentages (%), em units, or other CSS length units. Example: Setting Minimum Height #box { width: 300px; ...
Read More