EvoToolkit - v3.7.2 (Changelog)

getParent

This helper function cycles up the DOM tree and returns the first parent element matching the given class name.

Source

Contributors

Luke Harrison

Usage

When importing EvoToolkit directly as a compiled .js file without a build step, you can still use these tools through the global EvoToolkit object.

window.evotoolkit.tools.toolName()
import getParent from './../../../node_modules/evotoolkit/src/js/tools/getParent.js';
const myElem = document.querySelector('.js-my-elem');
const myElemsParent = getParent(myElem, 'c-input');