Skip to content

eles.indexOfId(id)

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

eles.indexOfId — Collection › Metadata and identity

Preview · Collection › Metadata and identity

Read in the complete API reference · All API members

// Position of the element with this id within the collection
eles.indexOfId(id: string): number

Position of the element with this id within the collection.

Parameters
NameDescription
id: string

the element id

Returns number

the index, or -1 when absent

Example

console.log(eles.indexOfId('a')); // 0

Example graph and handle setup