jQuery HTML Methods with Examples
jQuery HTML Methods allow you to manipulate the DOM in some specific syntax rules. jQuery HTML Methods can be used for changing attributes of an element, set an elements style properties, inserting, copying, removing, and so on. Following are jQuery HTML methods
jQuery Method | Description |
---|---|
after() | Insert content after selected elements |
append() | Inserts content to the end of selected elements |
attr() | Sets attribute values or returns the attribute value of selected elements |
before() | Insert content before selected elements |
clone() | Clone (copy) the selected elements |
detach() | Remove the selected elements |
empty() | Remove all child nodes and content of the selected elements |
html() | Sets or returns html contents (innerHTML) of the selected elements |
insertAfter() | Inserts HTML elements after the selected elements |
insertBefore() | Inserts HTML elements before the selected elements |
prepend() | Inserts content to the beginning of selected elements |
prependTo() | Inserts HTML elements to the beginning of selected elements |
prop() | Set or returns the CSS properties for the selected elements |
remove() | Remove the selected elements |
removeAttr() | Remove one or more attributes from selected elements |
removeProp() | Remove a property from selected elements |
replaceAll() | Replaces all selected elements with the new HTML elements |
replaceWith() | Replaces selected elements with the new content |
text() | Sets or returns the text content of selected elements |
unwrap() | Remove the parent element from selected elements |
val() | Sets or returns the current value of the selected form elements |
wrap() | Wrap an HTML structure around each selected elements |
wrapAll() | Wrap an HTML structure around all selected elements |
wrapInner() | Wrap an HTML structure around the content of each selected elements |