Skip to content

ele.id()

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

eles.id — Collection › Metadata and identity

Preview · Collection › Metadata and identity

Read in the complete API reference · All API members

// The first element's id
ele.id(): string | undefined

The first element's id. Cached on the handle, so it stays readable after the element is removed.

Returns string | undefined

the id, or undefined when the collection is empty

Example

console.log(eles.id()); // "a"

Example graph and handle setup