I am attaching an event to a link. The link lets the user toggle the display of a child div inside of a parent div. However, when the link is clicked, the event is run twice (div opens and then closes immediately).
I have tried using .click() and .bind() and it makes no difference which one I use. I have also tried using an anonymous function versus a callback function and there is no difference. I tried using return false and e.stopPropagation() and there is no difference. I have triple-checked that I am not binding the event more than once in my code. The only way I can get it to not fire twice is to put the call in the link's onclick attribute. I have seen several similar posts on this in the group, but I have not seen a reason why this happens or a fool-proof way to stop it from happening. The only thing I can think of is that one of the other JS libraries I am using on the page, like Matt Kruse's DynamicOptionList, etc... are interfering with the event propagation, but I don't know for sure if that is the cause. I am moving over from Prototype/Scriptaculous and had this all working without a problem using those libraries. I have posted the code at: http://jsbin.com/atiza Help!