Skip to content

Instantly share code, notes, and snippets.

@dualonn
dualonn / PropertyFlipper
Last active February 25, 2025 16:40
Useful functions for tab flow and other things.
const container = document.getElementById("container")
function indexFlip(container, elements, property, value_0, value_1){
const children = container.children
Array.from(children).forEach( (child) => {
child.setAttribute(property, child.getAttribute(property) == value_0 ? (elements.includes(child.tagName) ? value_1 : value_0) : value_0)
console.log(child.attributes)
if(child.children.length > 0){
indexFlip(child, elements, property, value_0, value_1)
}
})