src code

instance method Element#previous

Element#previous([expression[, index = 0]]) → Element
Element#previous([index = 0]) → Element
  • expression (String) – A CSS selector.

Returns element's first previous sibling (or the Nth, if index is specified) that matches expression. If no expression is provided, all previous siblings are considered. If none matches these criteria, undefined is returned.

This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.