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
Front End Technology Articles
Page 18 of 652
HTML ondrag Event Attribute
The ondrag event attribute in HTML is triggered continuously while an element is being dragged. This event fires repeatedly during the drag operation, making it useful for providing real-time feedback or updating the interface while dragging is in progress. By default, HTML images and links are draggable without requiring the draggable="true" attribute. For other elements like , , or , you must explicitly set draggable="true" to make them draggable. Syntax Following is the syntax for the ondrag event attribute − Content Parameters script − JavaScript code to execute when the element ...
Read MoreHTML oninput Event Attribute
The oninput event attribute in HTML is triggered when the user enters or modifies input in form elements such as , , and elements. Unlike onchange, which fires only when the element loses focus, oninput fires immediately as the user types or modifies content. Syntax Following is the syntax for the oninput event attribute − Where script is the JavaScript code or function to execute when the input event occurs. Using oninput with Textarea The oninput event is commonly used with elements to provide real-time feedback as users type. ...
Read MoreHTML oninvalid Event Attribute
The HTML oninvalid event attribute is triggered when an input field fails validation while submitting a form. This event occurs when form elements with validation constraints (like required, pattern, or type-specific validation) contain invalid data. Syntax Following is the syntax for the oninvalid event attribute − The script parameter contains JavaScript code that executes when the element becomes invalid during form submission. How It Works The oninvalid event fires when: A required field is empty during form submission An input value doesn't match the specified pattern An email input ...
Read MoreHTML onpaste Event Attribute
The HTML onpaste attribute is an event handler that triggers when a user pastes content into an HTML element. This event occurs when content is pasted using Ctrl+V, right-click paste, or any other paste operation. Syntax Following is the syntax for the onpaste attribute − Content Where script is the JavaScript code to execute when the paste event occurs. Parameters script − JavaScript code or function to execute when content is pasted into the element. Commonly Used Elements The onpaste attribute is most commonly used with form elements ...
Read MoreHTML onresize Event Attribute
The HTML onresize attribute is an event handler that triggers when the user resizes the browser window. This attribute is primarily used with the element to detect window resize events and execute JavaScript functions in response to size changes. Syntax Following is the syntax for the onresize attribute − Where script is the JavaScript code or function to execute when the window is resized. Parameters The onresize attribute accepts a single parameter − script − JavaScript code or function call to execute when ...
Read MoreHTML onsubmit Event Attribute
The HTML onsubmit event attribute is triggered when a form is submitted in an HTML document. This attribute allows you to execute JavaScript code when a user submits a form, enabling form validation, data processing, or other custom actions before the form data is sent to the server. Syntax Following is the syntax for the onsubmit event attribute − form content The script parameter contains JavaScript code or a function call that executes when the form is submitted. The function can return false to prevent the form submission or ...
Read MoreHTML onscroll Event Attribute
The onscroll event attribute in HTML is triggered when an element's content is scrolled using its scrollbar. This event fires continuously as the user scrolls through the element's content, making it useful for creating dynamic scroll-based interactions and animations. The onscroll event can be applied to any HTML element that has scrollable content, including the entire document body, div containers, textarea elements, and other elements with overflow properties set to scroll or auto. Syntax Following is the syntax for the onscroll event attribute − Content Where script is the JavaScript code or function ...
Read MoreHTML onsearch Event Attribute
The HTML onsearch event attribute is triggered when a user presses the "Enter" key or clicks the search button (×) in an HTML input element with type="search". This event is specifically designed for search input fields and provides a way to execute JavaScript when a search action is performed. Syntax Following is the syntax for the onsearch event attribute − Where script is the JavaScript code or function to execute when the search event occurs. Parameters The onsearch event attribute accepts the following parameter − script − JavaScript code ...
Read MoreHTML onselect Event Attribute
The HTML onselect event attribute is triggered when a user selects text within certain HTML elements. This event works primarily with form elements that contain editable text, such as and elements. Syntax Following is the syntax for the onselect event attribute − Content Where script is the JavaScript code to execute when text selection occurs. Supported Elements The onselect event attribute works with the following HTML elements − − Single-line text input fields − Password input fields − Search input fields − Multi-line text ...
Read MoreHTML onwheel Event Attribute
The onwheel event attribute in HTML is triggered when the user moves the mouse wheel up or down on an HTML element. This event fires regardless of whether the element is scrollable or not, making it useful for creating custom interactions based on wheel movement. Syntax Following is the syntax for the onwheel event attribute − Content Where script is the JavaScript code or function to be executed when the wheel event occurs. Parameters The onwheel event automatically passes an event object containing information about the wheel action − event.deltaY ...
Read More