jQuery HTML/CSS method
The table below lists all jQuery methods for working with HTML and CSS.
The following methods apply to HTML and XML documents. Except: the html() method.
method | describe |
---|---|
addClass() | Add one or more class names to selected elements |
after() | Insert content after selected element |
append() | Insert content at the end of the selected elements |
appendTo() | Inserts an HTML element at the end of the selected element |
attr() | Set or return the attribute/value of the selected element |
before() | Insert content before selected elements |
clone() | make a copy of the selected elements |
css() | Sets or returns one or more style properties for the selected elements |
detach() | Remove selected elements (keep data and events) |
empty() | Removes all child nodes and content from selected elements |
hasClass() | Checks whether the selected elements contain the specified class name |
height() | Set or return the height of the selected elements |
html() | Set or return the content of the selected elements |
innerHeight() | Returns the height of the element (including padding, excluding border) |
innerWidth() | Returns the width of the element (including padding, excluding border) |
insertAfter() | Insert an HTML element after the selected element |
insertBefore() | Insert an HTML element before the selected element |
offset() | Sets or returns the offset coordinates (relative to the document) of the selected elements |
offsetParent() | Returns the first positioned ancestor element |
outerHeight() | Returns the height of the element (including padding and border) |
outerWidth() | Returns the width of the element (including padding and border) |
position() | Returns the position of the element (relative to the parent element) |
prepend() | Insert content at the beginning of the selected elements |
prependTo() | Inserts an HTML element at the beginning of the selected element |
prop() | Set or return the attribute/value of the selected element |
remove() | Remove selected elements (including data and events) |
removeAttr() | Remove one or more attributes from selected elements |
removeClass() | Remove one or more classes from selected elements |
removeProp() | Remove properties set via the prop() method |
replaceAll() | Replace selected elements with new HTML elements |
replaceWith() | Replace selected elements with new content |
scrollLeft() | Set or return the horizontal scroll bar position of the selected element |
scrollTop() | Set or return the vertical scroll bar position of the selected element |
text() | Set or return the text content of the selected elements |
toggleClass() | Toggle between adding/removing one or more classes from selected elements |
unwrap() | Remove the parent element of the selected element |
val() | Set or return the attribute value of the selected element (for form elements) |
width() | Set or return the width of the selected elements |
wrap() | Wrap an HTML element around each selected element |
wrapAll() | Wrap an HTML element around all selected elements |
wrapInner() | Wrap HTML elements around the content of each selected element |
$.escapeSelector() | Escape characters or strings with special meaning in CSS selectors |
$.cssHooks | Provides a way to get and set specific CSS values by defining functions |