Attributes of Elements

Attributes of Elements

These methods get and set DOM attributes of elements.
Adds the specified class(es) to each element in the set of matched elements.
Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
Determine whether any of the matched elements are assigned the given class.
Get the HTML contents of the first element in the set of matched elements or set the HTML contents of every matched element.
Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.
Remove an attribute from each element in the set of matched elements.
Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
Remove a property for the set of matched elements.
Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the state argument.
Get the current value of the first element in the set of matched elements or set the value of every matched element.

.addClass()
Description:
Adds the specified class(es) to each element in the set of matched elements.

.attr()
Description:
Get the value of an attribute for the first element in the set of matched elements.

.hasClass()
Description:
Determine whether any of the matched elements are assigned the given class.

.html()
Description:
Get the HTML contents of the first element in the set of matched elements.

.prop()
Description:
Get the value of a property for the first element in the set of matched elements.

.removeAttr()
Description:
Remove an attribute from each element in the set of matched elements.

.removeClass()
Description:
Remove a single class, multiple classes, or all classes from each element in the set of matched elements.

.removeProp()
Description:
Remove a property for the set of matched elements.

.toggleClass()
Description:
Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the state argument.

.val()
Description:
Get the current value of the first element in the set of matched elements.

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *