Skip to content

eles.indexOf(ele)

eles.indexOf — Collection > Metadata and identity. Cytoscape.js signatures, parameters and return contract.

eles.indexOf — Collection › Metadata and identity

Preview · Collection › Metadata and identity

Read in the complete API reference · All API members

// Index of an element within this collection
eles.indexOf(ele: Collection): number

Index of an element within this collection.

Parameters
NameDescription
ele: Collection

the element to find; only its first element is used

Returns number

the index, or -1 when it is not in this collection

Example

console.log(eles.indexOf(cy.getElementById('a'))); // 0

Example graph and handle setup