findById (id);
id. Element ID.
findById finds an item in the collection by its ID.
Identifier is set using the Idproperty.
To execute the example, on HTML page in the HEAD tag, add links to the PP.js components library and to PP.css visual styles. Create the Breadcrumb component:
var bread = new PP.Ui.Breadcrumb({
ParentNode: document.getElementById("bc1"),
Width: 400,
Items:
[
{ Content: "Element1", Id: "el1" },
{ Content: "Element2", Id: "el2" },
{ Content: "Element3", Id: "el3" }
]
});
var a = bread.getItems().findById("el1");
console.log(a.getContent());
After executing the example the HTML page will contain the Breadcrumb component that includes three child items. Name of the item with the ID "el1 - Element1" is displayed in the browser console.
See also: