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 233 of 840
HTML DOM KeyboardEvent getModifierState( ) Method
The getModifierState() method is a property of the KeyboardEvent interface that returns a boolean value indicating whether the specified modifier key was pressed when the keyboard event occurred. This method is essential for detecting the state of modifier keys like Ctrl, Alt, Shift, and CapsLock during user input. Syntax Following is the syntax for the getModifierState() method − event.getModifierState(keyArg) Parameters The method takes a single parameter − keyArg − A string representing the modifier key to check. The parameter is case-sensitive. Return Value The method returns a boolean ...
Read MoreHTML DOM Input Password name Property
The HTML DOM Input Password name property is used for setting or returning the name attribute of an input password field. The name attribute helps in identifying the form data after it has been submitted to the server. JavaScript can also use the name attribute to reference form elements for manipulation. Syntax Following is the syntax for setting the name property − passwordObject.name = name Following is the syntax for getting the name property − var name = passwordObject.name Parameters The name parameter is a string that specifies the ...
Read MoreHTML DOM KeyboardEvent key Property
The KeyboardEvent key property returns the identifier of the key that was pressed during a keyboard event. This property provides the actual value of the key, making it useful for detecting specific characters, special keys, and modifiers in web applications. Syntax Following is the syntax for accessing the key property − event.key Where event is the KeyboardEvent object passed to the event handler function. Return Value The key property returns a string representing the key that was pressed. The returned values include − Printable characters − Letters, numbers, symbols (e.g., ...
Read MoreHTML DOM KeyboardEvent keyCode Property
The KeyboardEvent keyCode property returns the numeric unicode character code for the key that was pressed during a keyboard event. This property has been deprecated in favor of the key property, but it is still widely used in legacy code and remains functional across browsers. Note − The keyCode property is deprecated. Use the key property instead for more accurate and readable results in modern applications. Syntax Following is the syntax for accessing the keyCode property − event.keyCode The event.keyCode returns a numeric value representing the key that was pressed. For example, the ...
Read MoreHow can I vertically center a div element for all browsers using CSS?
To vertically center a div element for all browsers using CSS, there are several reliable methods. The most modern and widely supported approach is using Flexbox, which provides complete control over alignment and works consistently across all modern browsers. Vertical centering has historically been challenging in CSS, but modern layout methods like Flexbox and CSS Grid have made it straightforward. We'll explore multiple techniques to ensure compatibility across different browser versions and use cases. Method 1: Using Flexbox (Recommended) Flexbox is the most reliable method for vertical centering. It works in all modern browsers and provides excellent ...
Read MoreHTML DOM KeyboardEvent location Property
The HTML DOM KeyboardEvent location property returns a numeric value indicating the physical location of the pressed key on the keyboard. This property helps distinguish between keys that have the same keyCode but exist in different locations, such as left and right Shift keys. Syntax Following is the syntax for accessing the location property − event.location Return Values The property returns one of four possible numeric values representing different keyboard sections − Value Description 0 Standard keys (most keys on the keyboard including letters, numbers, ...
Read MoreHow can I vertically align elements in a div?
Vertically aligning elements within a div is a common requirement in web development. There are several effective methods to achieve perfect vertical alignment, each suitable for different scenarios and content types. Methods for Vertical Alignment We can vertically align elements in a div using any of the following approaches − Flexbox − Modern and most flexible approach Position property − Traditional method with absolute positioning Line-height property − Best for single-line text content Padding property − Simple method using equal top and bottom padding CSS Grid − Powerful layout method for complex alignments Using ...
Read MoreHTML DOM KeyboardEvent metaKey Property
The HTML DOM KeyboardEvent metaKey property returns a Boolean value indicating whether the meta key was pressed during a keyboard event. The meta key corresponds to the Cmd key on Mac and the Windows key on Windows systems. This property is commonly used to detect keyboard shortcuts that involve the meta key, such as Cmd+C for copy on Mac or Windows+R for the Run dialog on Windows. Syntax Following is the syntax for accessing the metaKey property − event.metaKey Return Value The metaKey property returns a Boolean value − true ...
Read MoreHTML DOM KeyboardEvent shiftKey Property
The HTML DOM KeyboardEvent shiftKey property is a read-only Boolean property that indicates whether the Shift key was pressed when a keyboard event occurred. It returns true if the Shift key was held down during the event, and false otherwise. This property is commonly used to detect modified key combinations, such as Shift+Enter for line breaks or Shift+Click for multi-selection functionality. Syntax Following is the syntax for accessing the shiftKey property − event.shiftKey Return Value The property returns a Boolean value − true − The Shift key was pressed during ...
Read MoreHTML DOM Label htmlFor Property
The HTML DOM Label htmlFor property is used to get or set the value of the for attribute of a label element. The for attribute creates an association between a label and a form control, improving accessibility and user experience by allowing users to click the label to focus or activate the associated form element. Syntax Following is the syntax for getting the for attribute value − labelObject.htmlFor Following is the syntax for setting the for attribute value − labelObject.htmlFor = "elementId" Return Value The htmlFor property returns a ...
Read More