May 07, 2021 jQuery
The following table lists all the jQuery methods used to work with HTML and CSS.
The following methods apply to HTML and XML documents. In addition to:html() method.
method | describe |
---|---|
addClass() | Add one or more class names to selected elements |
after() | Insert content after being selected |
append() | Insert content at the end of the selected element |
appendTo() | Insert HTML elements at the end of the selected element |
attr() | Set or return attributes / values of selected elements |
before() | Insert content before being selected |
clone() | Generate a copy of the selected element |
css() | Set or return one or more styles attributes for selecting elements |
detach() | Remove selected elements (reserved data and events) |
empty() | Remove all child nodes and content from selected elements |
hasClass() | Check if the selected element contains the specified Class name |
height() | Set or return the height of the selected element |
html() | Set or return the content of the selected element |
innerHeight() | Returns the height of the element (including padding, does not include border) |
innerWidth() | Returns the width of the element (including padding, not including border) |
insertAfter() | Insert HTML elements after being selected |
insertBefore() | Insert HTML elements before being selected |
offset() | Set or return offset coordinates (relative to documents) |
offsetParent() | Returns the first positioning 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 location of the element (relative to the parent element) |
prepend() | Insert content in the beginning of the election element |
prependTo() | Insert HTML element at the beginning of the election element |
prop() | Set or return attributes / values of selected elements |
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 the properties set by the PrOP () method |
replaceAll() | Replace the selected elements as new HTML elements |
replaceWith() | Replace the selected elements into new content |
scrollLeft() | Set or return to the horizontal scroll bar position of selected elements |
scrollTop() | Set or return a vertical scroll bar position for selected elements |
text() | Set or return the text content of selected elements |
toggleClass() | Add / remove one or more classes to switch between selected elements |
unwrap() | Remove parent elements of selected elements |
val() | Set or return the attribute value of the selected element (for the form element) |
width() | Set or return the width of the selected element |
wrap() | Wrapped in HTML elements around each selected element |
wrapAll() | Wrapped in HTML elements around all selected elements |
wrapInner() | Wrap the HTML element around each selected element |
Use jQuery to change the CSS style of HTML elements
We can change the CSS .css HTML elements directly through jQuery's method of processing.