Skip to content

Collection removeData

maxkfranz edited this page Mar 8, 2012 · 4 revisions

eles.removeData()

Deletes specified client-defined data associated with the elements.

eles.removeData()

Deletes all data for all elements in the collection

eles.removeData( key )

Deletes data for the specified key for all elements in the collection

key : The name of the data field to remove for the elements

eles.removeData( list )

Deletes data for all specified keys in the list for all elements in the collection

list : A string of space-separated data field names to remove, or an array of data field names to remove for the elements

Details

If eles.removeData() is called without arguments, it will remove all data for the element or collection.

Examples

var n1 = cy.nodes("#n1");
n1.data("weight", 56);
console.log( n1.data("weight") ); // 56

n1.removeData("weight");
console.log( n1.data("weight") ); // undefined

Clone this wiki locally