shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
previousElement
Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.query
Browse the passed element previous siblings to find the first element that matches the passed selector
Params
- $elm*-HTMLElement
The element to start on
- selector*-String
A css selector to search for
Return
- -HTMLElement|undefined
The element found or undefined
Example
import { previousElement } from '@blackbyte/sugar/dom'
const previousElm = previousElement($elm, '.my-cool-class');
if (previousElm) {
// we have found en element that matches the selector
}Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space