I am looking at the dynatree documentation, and it shows that the onClick callback function is passed two parameters: node & event. What exactly are these parameters? I would assume that the "node" parameter is of type DynaTreeNode.
What I am looking for is to get a reference to the element associated with the node when the onClick callback is called for an <a>
element. I know that in that case, node.data.href
will equal the href of the <a>
element and node.getEventTargetType(event)
will return "title". The <a>
element will have the class "dynatree-title". I am actually looking for a reference to the <span>
tag that immediately precedes the <a>
element. It will have the class "dynatree-expander". If I can get a reference to the <a>
element, I can use the jQuery .prev()
method to get the <span>
.
I need to perform conditional login in the onClick callback when it is called for an <a>
element that is preceded by a <span class="dynatree-expander">
element.
EDIT:
Because of the following posts, I have been focusing on the "node" parameter. They show it might have properties that are not listed in the documentation. However, I believe the "event" parameter might be the same as the "event" parameter to a jQuery on-click handler. Therefore, I should be using event.target
. I will experiment and see if that works.
Here are the posts showing the "node" parameter to have undocumented properties:
- This post shows
node.span
foronActivate
. - This post shows
node.span
foronPostInit
. - This post shows
node.span
,node.ul
, andnode.li
foronRender
.
But then I saw this post which showed the use of event.target
.