Returns the text content of selected elements.
Returns the content of selected elements (including HTML markup).
The following example demonstrates how to get the value of an input field with the jQuery val() method.
The following example demonstrates how to get the value of the href attribute in a link.
Sets the text content of selected elements.
Sets the content of selected elements (including HTML markup).
The following example demonstrates how to set the value of an input field with the jQuery val() method.
The following example demonstrates how to set the value of the href attribute in a link.
Return the string you wish to use as the new value from the function.
The jQuery append() method inserts content AT THE END of the selected HTML elements.
The jQuery prepend() method inserts content AT THE BEGINNING of the selected HTML elements.
Add Several New Elements.
jQuery after() and before() Methods.
The jQuery remove() method removes the selected element (and its child elements).
The jQuery empty() method removes the child elements of the selected element(s).
The jQuery remove() method also accepts one parameter, which allows you to filter the elements to be removed.
This example removes all <p> elements with class="test" and class="demo".
The following example shows how to add class attributes to different elements.
The headings and paragraphs will be assigned blue text.
The div will be given larger text size.
The following example shows how to remove a specific class attribute from different elements.
The headings and paragraph with blue text will have the attribute removed.
The following example will show how to use the jQuery toggleClass() method. This method toggles between adding/removing classes from the selected elements.
The headers and paragraphs will alternate between acquiring/losing the blue text attribute.
The following example will return the background-color value of the FIRST matched element.
The following example will set the background-color, font size and text color values for ALL matched elements: paragraphs.