I want to associate a javascript object with an HTML element. Is there a simple way to do this.
I noticed in the HTML DOM (http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html) defines a setAttribute method and it looks like this is defined for arbitrary attribute name. However this can only set string values. (You can of course use this to store keys into a dictionary.)
Specifics (though I'm mostly interested in the general question)
Specifically, I have html elements representing nodes in a tree and I'm trying to enable drag-and-drop, but the jquery drop event will only give me the elements being dragged and dropped
The normal pattern for getting information to event handlers seems to be to create the HTML elements at the same time as you are creating javascript objects and then to define event handlers by closing over these javascript objects - however this doesn't work too well in this case (I could have a global object that gets populated when a drag begins... but this feels slightly nasty)