views:

212

answers:

1

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'?

+6  A: 

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.

Gumbo
Unless, you have a container element that relies on event bubbling.
Ates Goral