Using JS to iterate through Tile Navigation items

Hi,

I’d like to be able to iterate through all items in a Tile Navigation using Javascript, but I am running into some issues.

What is the correct syntax to do something like:

var allTiles = tileNavigation1.control.getItems(); // it looks like this worked in version 4, but we are using v6

allTiles .forEach(function (tile) {

//some cool code

});

Thanks in advance for any help!!

Hi Bekah,

Your code seems to work for me on version 6.x.

Could something else be at play like another statement in your code causing the problem? I’d recommend adding the debugger; line like i did so that you can use the browser development tools to break in your code and see what is happening.

Here is a helpful article if you’re unfamiliar with this technique.
https://javascript.info/debugging-chrome