Change background color of a <p> element when the mouse pointer hovers over it:
The hover() method specifies two functions to run when the mouse pointer hovers over the selected elements.
This method triggers both the mouseenter and mouseleave events.
Note: If only one function is specified, it will be run for both the mouseenter and mouseleave events.
Parameter | Description |
---|---|
inFunction | Required. Specifies the function to run when the mouseenter event occurs |
outFunction | Optional. Specifies the function to run when the mouseleave event occurs |