I am trying to run a loop over the code where i want to loop over the div and if there is any tab index on any element inside that div, i want it to be -1 instead of 0
i tried this code but its not working,
document.querySelector('.app-container-grid').forEach((grid,index) => {
grid.setAttribute("tabindex", -1);
});
it just keeps the tabindex to whatever value it has and does it not change it to -1
i want to loop over the div and if there is any tab index on any element inside that div
This will select all elements with a tabindex attribute inside .app-container-grid and changes the tabindex attribute to "-1"
document.querySelectorAll('.app-container-grid [tabindex]').forEach((element) => {
element.setAttribute("tabindex", "-1");
});