Skip to main content

forEach()

allows iterating through all the nested items

forEach(callback: (item: obj, index: number, array: obj[]) => void, tree?: boolean): void;

Parameters:

  • callback: function - a function that will iterate over the items of the fieldset. It is called with the following arguments:
    • item: object - the object of an item
    • index: number - the index of an item
    • array: object[] - an array of iterated items
  • tree: boolean - defines, whether all the nested items should be iterated, false by default

Example

form.getItem("fieldset").forEach((item, index, arr) => {
console.log(index, item, arr);
}, true);