# Active states (current item markup) for Mega Menu items

**URL:** <https://forum.bricksbuilder.io/t/active-states-current-item-markup-for-mega-menu-items/12343>\
**Category:** Feature Requests / Improvements\
**Created:** [May 18, 2023, 3:24pm UTC](https://forum.bricksbuilder.io/t/active-states-current-item-markup-for-mega-menu-items/12343 "2023-05-18T15:24:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quantos](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/quantos/32/641_2.png) [@Quantos](https://forum.bricksbuilder.io/u/Quantos)\
**Post date:** [May 18, 2023, 3:24pm UTC](https://forum.bricksbuilder.io/t/active-states-current-item-markup-for-mega-menu-items/12343/1 "2023-05-18T15:24:35Z")

</div>

Hi guys,

Just adding this one here although I’ve some more details on my ‘how to’ at [Active (current item) states for Mega Menu](https://forum.bricksbuilder.io/t/active-current-item-states-for-mega-menu/12078)

But I can’t see any other comments/feature requests on this but believe we will need some kind of method to add active state highlighting (or at least classes in them) to the top/parent menu items in the Mega Menu, exactly as the older Nav Menu does at present, which it does excellently.

Some other detection method for the current page so that active state classes could be added to any menu item found in the Mega Menu would be a huge amount of icing on the cake.

Many thanks guys.

Q.

---

<div class="post-metadata">

**Author:** ![Quantos](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/quantos/32/641_2.png) [@Quantos](https://forum.bricksbuilder.io/u/Quantos)\
**Post date:** [May 18, 2023, 3:26pm UTC](https://forum.bricksbuilder.io/t/active-states-current-item-markup-for-mega-menu-items/12343/2 "2023-05-18T15:26:50Z")

</div>

top dude Manc suggested some starter js for this, to get the idea across…

```auto
<script>
var current = 0;
for (var i = 0; i < document.links.length; i++) {
    if (document.links[i].href === document.URL) {
        current = i;
    }
}
document.links[current].classList.add('active');
</script>

```

---

<div class="post-metadata">

**Author:** ![manc](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/m/e19adc/32.png) [@manc](https://forum.bricksbuilder.io/u/manc)\
**Post date:** [May 18, 2023, 5:30pm UTC](https://forum.bricksbuilder.io/t/active-states-current-item-markup-for-mega-menu-items/12343/3 "2023-05-18T17:30:01Z")

</div>

That js is kinda quick n dirty though haha. I think at least a few issues with the active state should be solved with the latest beta since it lets you assign actual wp menus to dropdowns and mega menus.

Depending on the complexity of the mega menu we’ll end up with a bunch of menus but since they are native wp menus, active states should work. If someone already tested that, feel free to report back so we can figure out what’s still missing 🙂

---

<div class="post-metadata">

**Author:** ![Quantos](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/quantos/32/641_2.png) [@Quantos](https://forum.bricksbuilder.io/u/Quantos)\
**Post date:** [May 18, 2023, 6:55pm UTC](https://forum.bricksbuilder.io/t/active-states-current-item-markup-for-mega-menu-items/12343/4 "2023-05-18T18:55:13Z")

</div>

Excellent dude. Looking forward to testing that more too. cheers
