I am looking to print all data elements of a JQuery object. Here is my current code.
cy.on('tap', 'node', function(evt){
var clickedData = evt.target.attr("data");
document.getElementById("nodeInfo").innerHTML = clickedData;
});
Here is the evt.target in the console
Oe(1)
0: Oe [Oe(1), _private: {…}]
length: 1
_private:
active: false
animation: {current: Array(0), queue: Array(0)}
appliedInitStyle: true
arrowBounds: {source: null, target: null, mid-source: null, mid-target: null}
autoHeight: undefined
autoPadding: undefined
autoWidth: undefined
backgrounding: false
bbCache: {x1: 1090.4404404505497, y1: 155.49162695178342, x2: 1172.4404404505497, y2: 237.49162695178342, w: 82, …}
bbCachePosKey: 0
bbCacheShift: {x: 0, y: 0}
bodyBounds: {x1: 1090.4404404505497, y1: 155.49162695178342, x2: 1172.4404404505497, y2: 237.49162695178342, w: 82, …}
children: []
classes: Set(0) {size: 0}
compoundBoundsClean: false
cy: Za {_private: {…}}
data:
id: "0000_86a2e18d-ea5f-44f3-94a3-aa5cf72f8652_20211010-224514"
name: "Ryan"
type: "somnas:Person"
[[Prototype]]: Object
edges: [Oe(1)]
emitter: Ni {qualifierCompare: ƒ, eventMatches: ƒ, addEventFields: ƒ, callbackContext: ƒ, beforeEmit: ƒ, …}
grabbable: true
grabbed: false
group: "nodes"
hasPie: false
labelBounds: {all: {…}, source: null, target: null, main: {…}, sourceRot: null, …}
labelDimsKey: 1274045721130407
labelKey: -1742728187463711
labelStyleKey: 2774432038878951
listeners: []
You can see the data element I want printed.
Expected: id: xxx name: xxx type: xxx
Result: undefined