mfreitas
mfreitas

Reputation: 2405

Dojo get next sibling based on current event target

I have this dropdown menu, and all i want to do is upon firing the onmouseenter event, to change the border-left of the targets next sibling to white. So far i can address the currentTarget's border-left with ease, but i cant find a way to do the same for the next sibling. Any ideas ?

Upvotes: 4

Views: 5673

Answers (2)

Rajkamal Subramanian
Rajkamal Subramanian

Reputation: 6944

please try this

dojo.query(evt.currentTarget).next()[0]

Upvotes: 6

Fu Cheng
Fu Cheng

Reputation: 3395

The DOM node attribute nextSibling can be used to get the next sibling. See https://developer.mozilla.org/En/DOM/Node.nextSibling.

If you want to apply some filtering when getting next sibling, e.g. get the next sibling with a certain CSS class name, try to use dojo.query. For example,

dojo.query(node).siblings(".myClass")

returns a node list of siblings of node with class name myClass.

Upvotes: 2

Related Questions