Quick Reference
This is a quick reference list of jQuery HTML/CSS Methods that are used to manipulate the selected elements.
- jQuery – add() MethodThe add() method adds elements to an existing group of elements in the whole document, or just inside context elements if specified.
- jQuery – addClass() MethodThe addClass() method adds one or more class names to the selected elements.
- jQuery – after() MethodThe after() method inserts specified content (HTML tags, jQuery objects, DOM elements) after the selected elements.
- jQuery – append() MethodThe append() method inserts specified content (HTML tags, jQuery objects, DOM elements) at the end of the selected elements.
- jQuery – before() MethodThe before() method inserts specified content (HTML tags, jQuery objects, DOM elements) before the selected elements.
- jQuery – appendTo() MethodThe appendTo() method inserts HTML elements at the end of the selected element or elements.
- jQuery – attr() MethodThe attr() method sets attributes and values of the selected elements.
- jQuery – clone() MethodThe clone() method makes a copy of selected elements, including child nodes, text and attributes.
- jQuery – css() MethodThe css() method sets one or more style properties for the selected elements.
- jQuery – detach() MethodThe detach() method removes the selected elements, including all text and child nodes, but keeps data and events.
- jQuery – empty() MethodThe empty() method removes all child nodes and content from the selected elements, but does NOT remove the element itself or its attributes.
- jQuery – hasClass() MethodThe hasClass() method checks if any of the selected elements have a specified class name, and returns “true” if any do.
- jQuery – height() MethodThe height() method sets the height of the selected elements, not including padding, border, or margin.
- jQuery – html() MethodThe html() method sets the content (innerHTML) of the selected elements.
- jQuery – innerHeight() MethodThe innerHeight() method returns the inner height of the FIRST matched element, including padding, but NOT including border and margin.
- jQuery – innerWidth() MethodThe innerWidth() method returns the inner width of the FIRST matched element, including padding, but NOT including border and margin.
- jQuery – insertAfter() MethodThe insertAfter() method inserts HTML elements after the selected elements.
- jQuery – insertBefore() MethodThe insertBefore() method inserts HTML elements before the selected elements.
- jQuery – offset() MethodThe offset() method sets the offset coordinates for ALL matched elements the selected elements, relative to the document.
- jQuery – offsetParent() MethodThe offsetParent() method returns the first positioned parent element.
- jQuery – outerHeight() MethodThe outerHeight() method returns the outer height of the FIRST matched element, including padding and border.
- jQuery – outerWidth() MethodThe outerWidth() method returns the outer width of the FIRST matched element, including padding and border.
- jQuery – position() MethodThe position() method returns the element’s top and left position, in pixels (relative to its parent), of the first matched element.
- jQuery – prepend() MethodThe prepend() method inserts specified content (HTML tags, jQuery objects, DOM elements) at the beginning of the selected elements.
- jQuery – prependTo() MethodThe prependTo() method inserts HTML elements at the beginning of the selected element or elements.
- jQuery – prop() MethodThe prop() method sets properties and values of the selected elements.
- jQuery – remove() MethodThe remove() method removes the selected elements, including all text and child nodes.
- jQuery – removeAttr() MethodThe removeAttr() method removes one or more attributes from the selected elements.
- jQuery – removeClass() MethodThe removeClass() method removes one or more class names from the selected elements.
- jQuery – removeProp() MethodThe removeProp() method removes a property set by the prop() method.
- jQuery – replaceAll() MethodThe replaceAll() method replaces selected elements with new HTML elements.
- jQuery – replaceWith() MethodThe replaceWith() method replaces selected elements with new content.
- jQuery – scrollLeft() MethodThe scrollLeft() method sets the horizontal scrollbar position for the selected elements.
- jQuery – scrollTop() MethodThe scrollTop() method sets the vertical scrollbar position for the selected elements.
- jQuery – text() MethodThe text() method sets the text content of the selected elements, overwriting the content of ALL matched elements.
- jQuery – toggleClass() MethodThe toggleClass() method toggles between adding and removing one or more class names from the selected elements.
- jQuery – unwrap() MethodThe unwrap() method removes the parent element of the selected elements.
- jQuery – val() MethodThe val() method sets the value attribute of the selected elements.
- jQuery – width() MethodThe width() method sets the width of the selected elements, not including padding, border, or margin.
- jQuery – wrap() MethodThe wrap() method wraps specified HTML element(s) around EACH selected element separately. Every selected element will be wrapped on its own.
- jQuery – wrapAll() MethodThe wrapAll() method wraps specified HTML element(s) around all selected elements as a whole.
- jQuery – wrapInner() MethodThe wrapInner() method wraps specified HTML element(s) around the CONTENT (innerHTML) of each selected element.
jQuery Notes:
- To use jQuery on your site, it must first be downloaded from the official jQuery site and linked to in your document <head>, or linked to via a CDN in your document <head>
- It is generally good practice to place your jQuery code/function inside the document load function so that the action takes place ONLY after the document has finished loading
- When using jQuery, single or double quotation marks are acceptable and work identically to one another; choose whichever you prefer, and stay consistent
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.