I'm trying to do add an event listener to a dynamically created object
var teamDiv = document.createElement("div");
obviously, following doesn't work:
teamDiv.onDragStart="drag(event)";
so I tried this:
teamDiv.addEventListener("dragstart",function(event){drag(event);});
and
var dragFunction = new Function("event","drag(event);");
teamDiv.addEventListener("dragstart", dragFunction);
and
teamDiv.addEventListener("dragstart", function(teamDiv) {dragObj(teamDiv);});
but nothing works. Can anyone help me with this?
thanks in advance,
Dirk