Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 1.02 KB

previous.md

File metadata and controls

23 lines (17 loc) · 1.02 KB

previous

Browse the passed element previous siblings to find the first element that matches the passed selector

Parameters

Name Type Description Status Default
elm { HTMLElement } The element to start on required
selector { String } A css selector to search for required

Return { HTMLElement } The element found or null

Example

	import previous from 'coffeekraken-sugar/js/dom/previous'
const previousElm = previous(myCoolElement, '.my-cool-class');
if (previousElm) {
		// we have found en element that matches the selector
}

Author : Olivier Bossel [email protected] https://olivierbossel.com