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 on Trending Technologies
Technical articles with clear explanations and examples
HTML DOM Input Search autofocus Property
The HTML DOM Input Search autofocus property is associated with the HTML element's autofocus attribute. This property is used for setting or returning whether the input search field should automatically be focused when the page loads. Syntax Following is the syntax for setting the autofocus property − searchObject.autofocus = true|false Following is the syntax for returning the autofocus property − searchObject.autofocus Property Values The autofocus property accepts the following boolean values − true − The search field should get focus when the page loads. false − ...
Read MoreHTML DOM TableHeader abbr Property
The HTML DOM TableHeader abbr property sets or returns the value of the abbr attribute of a table header cell ( element). The abbr attribute provides a short abbreviation or description for the header cell content, which is helpful for screen readers and accessibility tools. Syntax Following is the syntax for getting the abbr value − object.abbr Following is the syntax for setting the abbr value − object.abbr = "text" Parameters text − A string value that specifies the abbreviation or short description for the table header cell. ...
Read MoreHow can I make a div not larger than its contents?
To make a div not larger than its contents, you need to change how the div behaves in the document flow. By default, div elements are block-level elements that take up the full width of their parent container, regardless of their content size. There are several CSS methods to make a div shrink to fit its contents. The most common approaches are using display: inline-block, display: inline, width: fit-content, or float properties. Method 1: Using display: inline-block The display: inline-block property makes the div behave like an inline element horizontally (shrinking to content width) while retaining block-level ...
Read MoreHow to add a checkbox in forms using HTML?
The checkbox is a type of HTML input element that appears as a square box users can check or uncheck. Checkboxes are essential for forms where users need to select multiple options from a list, such as choosing interests, agreeing to terms, or selecting preferences. When a form is submitted, the data from checked checkboxes is sent to the server as name-value pairs. A checkbox can exist in three states − checked, unchecked, or indeterminate. The indeterminate state is typically used in JavaScript for tri-state checkboxes or when representing a partially selected group. Syntax Following is the ...
Read MoreHTML DOM Input Week name Property
The HTML DOM Input Week name property allows you to retrieve or modify the name attribute of an HTML input element with type="week". The name attribute identifies the form field when data is submitted to the server. Syntax Following is the syntax for getting the name attribute − inputWeekObject.name Following is the syntax for setting the name attribute − inputWeekObject.name = "string" Parameters string − A string value representing the name of the week input field. This name is used when the form is submitted. Return ...
Read MoreHTML DOM DragEvent
The HTML DOM DragEvent is a type of event that gets executed whenever elements are being dragged and dropped on a web page. This event interface was introduced in HTML5 and provides methods to handle drag-and-drop interactions between elements. The DragEvent extends the MouseEvent interface and provides additional functionality specific to drag-and-drop operations. It allows developers to create interactive user interfaces where users can drag elements from one location and drop them onto valid drop targets. Properties Following is the main property for the HTML DOM DragEvent − Property Description ...
Read MoreHTML DOM Input Search defaultValue Property
The HTML DOM Input Search defaultValue property is used for setting or getting the default value of a search field. The defaultValue of an element is the original value assigned to the value attribute when the page loads. The key difference between value and defaultValue properties is that defaultValue retains the original default value while value changes based on user input in the search field. Syntax Following is the syntax to get the defaultValue property − searchObject.defaultValue Following is the syntax to set the defaultValue property − searchObject.defaultValue = value ...
Read MoreHTML DOM Window closed Property
The HTML DOM Window closed property returns a boolean value that indicates whether a window reference is closed or not. This property is particularly useful when working with popup windows opened using window.open(), allowing you to check their state before performing operations. Syntax Following is the syntax for the Window closed property − window.closed Return Value The closed property returns − true − If the window is closed or was never opened false − If the window is currently open Note: For the main browser window, this property always ...
Read MoreRetrieve the position (X,Y) of an HTML element
The position (X, Y) of an HTML element refers to its coordinates on a web page, where X represents the horizontal position and Y represents the vertical position. JavaScript provides several methods to retrieve these coordinates relative to different reference points like the viewport, document, or parent element. The getBoundingClientRect() Method The getBoundingClientRect() method is the most commonly used approach to get an element's position. It returns a DOMRect object containing the element's size and position relative to the viewport. Syntax var rect = element.getBoundingClientRect(); var x = rect.x; // or rect.left var y ...
Read MoreHTML DOM Input Week Object
The HTML DOM Input Week Object represents an HTML input element with type week. This object allows users to select a specific week and year, providing methods and properties for manipulating week-based form inputs programmatically. Syntax Following is the syntax to create an input element with type week using JavaScript − var weekObject = document.createElement("INPUT"); weekObject.type = "week"; You can also access an existing week input element − var weekObject = document.getElementById("weekId"); Properties The Input Week Object supports the following properties − Property Description ...
Read More