I was inspecting my source on a page that uses Rafael js and some elements have “element.click(handler)”
on several elements however I never see any “onclick=handler()” or any events on the svg elements, so how does it know to call handler when the element is clicked?
The reason I ask is because one of my elements works the first time you click on it, but doesn’t work after that. There is no js error, it just doesn’t call the method anymore and I don’t know how to debug this, since I can’t tell if the onclick is gone from the element or what.
Any ideas?
Thanks
You can not see for eg. because he is not using that coding.
He uses his own addEvent function that uses addEventListener(FF) or attachEvent (MS) depending on what browser that code runs.
On FF/chrome install firebug plugin and use debugger; statement.
Use console.log(); or alert() to represent yourself what’s going on in that handler function.
And take a good look at ‘this’ if you are using it. ‘This’ changes scope depending on fun or object.