Attributes

jQuery

Category: Attributes


These methods get and set DOM attributes of elements.

.attr()

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.

.prop()

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.

.toggleClass()

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 switch argument.