First and Last Elements in jQuery
Pick ends of a selection with first(), last(), and eq(index).
Pick ends of a selection with first(), last(), and eq(index).
Get/set styles with .css(); prefer classes for reusable design.
Create elements and insert or remove them from the DOM.
Insert content at the end (append) or start (prepend) of a parent.
remove() deletes the node; empty() clears children only.
Move through the DOM relative to a selection: parents, children, siblings.
Use parent(), parents(), and closest() to walk up the tree.