Question:

Which of the following JavaScript event handlers is triggered when the mouse pointer leaves an HTML element?

Show Hint

To create dynamic hover effects without CSS transitions, pair onmouseover (to add styles/images) with onmouseout (to restore original styles/images).
Updated On: Jun 29, 2026
  • onmouseover
  • onmouseout
  • onchange
  • onload
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation



Step 1: Understanding JavaScript Event Handlers:

Event handlers are properties of HTML elements that execute a designated block of JavaScript code when a specific asynchronous event (like a click, hover, or focus change) occurs.

Step 2: Analyzing Mouse-Specific Events:


onmouseover: Triggers immediately when the user's mouse pointer enters the bounding box of the HTML element.
onmouseout: Triggers immediately when the user's mouse pointer leaves or moves outside the boundaries of the HTML element.
onchange: Triggered when the value of an input element changes (commonly used on select drop-downs, text inputs, or radio buttons).
onload: Fires when the browser has completed loading the document object model, styles, and image assets. Therefore, onmouseout is the handler designed specifically to listen for the cursor departing from an element.
Was this answer helpful?
0
0