How can I print all information e.g. for the Mouseevent object in Dojo. I tried this:
myObject = {
id: "myObject", onClick: function(evt) {
dojo.byId("objectPrint").innerHTML = dojo.toJson(evt);
}
};
I have a div container that has the id objectPrint. But it doesn’t work.
Perhaps you should use
innerTextinstead ofinnerHTMLwhich expects a text string in valid HTML format? Yours is not valid HTML — it is JSON.For FireFox, you’ll need to use
textContent.DOM event objects contain the
targetproperty which points to a DOM node. dojo.toJson() is used to serialize a JavaScript hash object, and you can’t use it to serialize a DOM node.You probably should be building your own hash object for dojo.toJson() in order to look at the event object:
However, this is a very convoluted way of doint it. Better to use
console.log.