Brisbe
Brisbe

Reputation: 1628

How can I trigger an onmouseover from another function?

In one function, having nothing to do with another item, how can I trigger an onmouseover event in javascript on a div with id 'item'?

Upvotes: 0

Views: 2025

Answers (1)

Gumbo
Gumbo

Reputation: 655677

Simply call the onmouseover function of that element:

document.getElementById("item").onmouseover()

document.getElementById("item") refers to the element, elem.onmouseover to the function for the mouseover event and appending () to it will call that function.

Upvotes: 7

Related Questions