# JavaScript Bs_Tree example 6

tree similar to example 2. the special things here are:

- there is an onClickCaption event on all tree elements.
- it fires an assigned alert function.
- the tree element will remain active (clicked), see the yellow background. this is a customizable default behavior.
- the 'yahoo sports' node has an 'onBeforeOpen' and 'onBeforeClose' event attached. it checks if it's allowed to toggle the node.

| allow toggling "yahoo sports" node