The .id () function works with elements, but you do not have an element in the event handler. You are attached to the kernel without any delegate element selector, so you are attached to the kernel itself - this means that the link to thispoints to cy.
This is probably what you meant:
cy.on('click', 'node', function(evt){
console.log( 'clicked ' + this.id() );
});
source
share