HTML Articles

Page 20 of 151

HTML oncopy Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 199 Views

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 More

HTML oncut Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 123 Views

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 More

HTML oncontextmenu Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 214 Views

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 More

HTML ondrag Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 208 Views

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 More

HTML oninput Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 420 Views

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 More

HTML oninvalid Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 321 Views

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 More

HTML onpaste Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 294 Views

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 More

HTML onresize Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 162 Views

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 More

HTML onsubmit Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 488 Views

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 More

HTML onscroll Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 268 Views

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
Showing 191–200 of 1,509 articles
« Prev 1 18 19 20 21 22 151 Next »
Advertisements