0

I build a cytoscape object in a div and set all parameters required what is working just fine! On the "tap" event I add a class to the node just like this:

ready: function(){
   window.cy = this;
   cy.elements().unselectify();
   cy.on('tap', 'node', function(e){
   var node = e.cyTarget; 
   node.addClass('test');

What I want is to select nodes with this class but from outside the ready code, when clicking on a button of the web page. There is any way to do so ?

thanks for your reply!

pbardou
  • 3
  • 3

1 Answers1

2

If you have access to your cy object, you can use cy.$() with any of the available selectors. The ready event is to know when your graph has loaded and finished the initial layout.

maxkfranz
  • 11,896
  • 1
  • 27
  • 36