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
HTML Articles
Page 20 of 151
HTML oncopy Event Attribute
The HTML oncopy attribute is an event handler that triggers when a user copies the content of an HTML element. This attribute can be applied to any HTML element to execute JavaScript code whenever the copy action occurs, whether through keyboard shortcuts (Ctrl+C), right-click context menu, or browser menu options. Syntax Following is the syntax for the oncopy attribute − Content Where script is the JavaScript code to execute when the copy event is triggered. Parameters The oncopy attribute accepts a single parameter − script − JavaScript code or function ...
Read MoreHTML oncut Event Attribute
The HTML oncut event attribute is triggered when a user cuts content from an HTML element. This event fires when the cut operation is performed using Ctrl+X keyboard shortcut, right-click context menu, or any other method that removes selected content to the clipboard. Syntax Following is the syntax for the oncut event attribute − Content Where script is the JavaScript code to execute when the cut event occurs. Parameters The oncut event attribute accepts the following parameter − script − Specifies the JavaScript code or function to run when the ...
Read MoreHTML oncontextmenu Event Attribute
The oncontextmenu event attribute in HTML is triggered when a user right-clicks on an element to open the context menu. This event allows developers to customize behavior when the context menu appears, such as displaying custom menus or preventing the default context menu from showing. Syntax Following is the syntax for the oncontextmenu event attribute − Content The script can be a JavaScript function call or inline JavaScript code that executes when the user right-clicks on the element. Parameters The oncontextmenu event handler receives an event object as a parameter with the ...
Read MoreHTML 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 More