jQuery - Manipulation Methods
jQuery is a popular JavaScript library that simplifies HTML document traversing, event handling, and manipulation. It provides a wide range of methods that can be used to manipulate the HTML elements and their properties. Here are some of the most commonly used jQuery manipulation methods:
.html(): This method is used to get or set the HTML content of an element. It accepts an optional parameter that represents the new HTML content to be set.
.text(): This method is similar to the .html() method, but it gets or sets the plain text content of an element.
.attr(): This method is used to get or set the value of an attribute of an element. It accepts two parameters: the first is the name of the attribute, and the second is the value to be set (optional).
.addClass(): This method adds one or more CSS classes to an element.
.removeClass(): This method removes one or more CSS classes from an element.
.toggleClass(): This method toggles one or more CSS classes of an element.
.css(): This method is used to get or set one or more CSS properties of an element.
.show(): This method shows the selected element by removing the "display:none" style.
.hide(): This method hides the selected element by adding "display:none" style.
.fadeIn(): This method fades in the selected element by gradually increasing the opacity of the element.
.fadeOut(): This method fades out the selected element by gradually decreasing the opacity of the element.
.slideUp(): This method animates the height of the selected element to 0, making it disappear by sliding up.
.slideDown(): This method animates the height of the selected element from 0 to its original height, making it appear by sliding down.
These are some of the commonly used jQuery manipulation methods that you can use to dynamically modify the content and behavior of your web page.