Plain JavaScript

Vanilla JS utilities for writing powerful web applications without jQuery.

querySelectorAll - a CSS selector method like the one provided by jQuery.

jQuery: $(selector), $(selector, context)

getElementsByClassName - a fast way of selecting DOM elements by class name in modern browsers. Does not work in IE 8 and below.

jQuery: $('.foo')

getElementsByTagName - a fast and cross browser safe way for selecting DOM elements by tag name, e.g. "div", "a", "span", etc.

jQuery: $('div')

getElementById - a fast and cross browser safe way for selecting DOM elements.

jQuery: $('#foo')

Check the current elements against a CSS selector.

jQuery: $.is()

Getting the parent DOM node of an element.

jQuery: $.parent(), $.parents()

Get the next, previous or all siblings of an element or retrieve siblings that match a given selector.

jQuery: $.siblings(), $.next(), $.nextAll(), $.prev, $.prevAll()

Get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

jQuery: $.closest()

Getting the children of a DOM element.

jQuery: $.children()

How to create a new element and attach it to the DOM tree.

jQuery: $(string)

Remove an element from the DOM tree and insert a new one in its place.

jQuery: $.replaceAll(), $.replaceWith()

Remove the parents of an element from the DOM, leaving the element's content in place.

jQuery: $.unwrap()

Remove all child nodes of an element from the DOM.

jQuery: $.empty()

Remove an element from the DOM tree.

jQuery: $.remove(), $.detach()

Insert an HTML structure after or before a given DOM tree element.

jQuery: $.after(), $.before(), $.insertAfter(), $.insertBefore

Get the combined text contents of an element, including its descendants, or set the text content of the element.

jQuery: $.text()

Read or write the HTML content of an element.

jQuery: $.html()

Insert a new element or an HTML structure to the end or the beginning of another element's content.

jQuery: $.append(), $.appendTo(), $.prepend(), $.prependTo()

How to use a given container as wrapper for another DOM element.

jQuery: $.wrap(), $.wrapAll()

Create a deep copy of a DOM element.

jQuery: $.clone()

How to loop through a NodeList and do something with each element.

jQuery: $.each()

Get the value of an input field or the href of an anchor. Learn how to work with element properties.

jQuery: $.prop()

addClass, removeClass, hasClass - three important functions for working with DOM element classes.

jQuery: $.addClass, $.removeClass, $.hasClass, $.toggleClass

Read, write, or remove data values of an element.

jQuery: $.data()