Attributes & PropertiesS2C Home « Attributes & Properties

Click a jQuery 3.5 API Attributes & Properties Method signature in the table below to see in-depth information on it.

AlphabeticallyDescription
AttributesTop
The .attr() method has four signatures:
.attr( attributeName )Retrieve an attribute value from the first element within the matched set.
.attr( attributeName, value )Set a single attribute value within the matched set.
.attr( attributes )Use a plain JavaScript object of key-value pairs to set multiple attribute values within the matched set.
.attr( attributeName, function(index, attr))Execute a function returning the attribute value to set.
The .html() method has three signatures:
.html()Retrieve the HTML contents from the first element within the matched set.
.html( htmlString )Set the HTML contents of each element within the matched set.
.html( function(index, oldhtml) )Execute a function that returns the HTML contents to set.
The .prop() method has four signatures:
.prop( propertyName )Retrieve a property value from the first element within the matched set.
.prop( propertyName , value )Set a single property value within the matched set.
.prop( properties )A plain JavaScript object of key-value pairs to set multiple property values within the matched set.
.prop( propertyName, function(index, prop))Execute a function returning the property value to set.
The .removeAttr() method has one signature:
.removeAttr( attributeName )Remove one or more attributes from each element within the matched set.
The .removeProp() method has one signature:
.removeProp( propertyName )Remove a property from within the matched set.
The .val() method has three signatures:
.val()Retrieve the current value from the first element within the matched set.
.val( value )Set the value of each element within the matched set.
.val( function(index, value) )Execute a function that returns the value to set.
ClassTop
The .addClass() method has two signatures:
.addClass( className )Add one or more classes to each element within the matched set.
.addClass( function(index, currentClass) )A function returning one or more classes to be added to each element in matched set.
The .hasClass() method has one signature:
.hasClass( className )Determine whether specified class is assigned to any elements in the matched set.
The .removeClass() method has three signatures:
.removeClass()Remove all classes from each element within the matched set.
.removeClass( className)Remove one or more classes from each element within the matched set.
.removeClass( function(index, currentClass))Execute a function that returns one or more classes to be removed from each element within the matched set.
The .toggleClass() method has three signatures:
.toggleClass( [ switch ] )Remove all classes for each element within the matched set optionally filtered with a boolean switch.
.toggleClass( className [, switch ])Toggle one or more classes for each element within the matched set optionally filtered with a boolean switch.
.toggleClass( function(index, class [,switch])Execute a function that returns one or more classes to be removed from each element within the matched set optionally filtered with a boolean switch.
CSSTop
The .css() method has five signatures:
.css( propertyName )Retrieve the value of a CSS property from the first element within the matched set.
.css( propertyNames )Retrieve the values of the array of CSS properties from the first element within the matched set.
.css( propertyName, value )Set a single CSS property value within the matched set.
.css( properties )Use a plain JavaScript object of key-value pairs to set multiple CSS properties within the matched set.
.css( propertyName, function(index, value) )Execute a function returning the CSS property value to set.
jQuery.cssHooksOverride CSS property retrieval and setting, normalize CSS property naming and create custom properties by hooking directly into jQuery.
The jQuery.escapeSelector() method has one signature:
jQuery.escapeSelector( selector )Escape characters with special meanings in a CSS selector.
Style PropertiesTop
The .height() method has three signatures:
.height()Retrieve currently computed CSS height from first element in the matched set.
.height( value )Set the CSS height of each element within the matched set.
.height( function(index, value) )Execute a function returning the CSS height to set.
The .innerHeight() method has one signature:
.innerHeight()Retrieve the currently computed CSS height of the first element within the matched set including padding, but not border or margin.
The .innerWidth() method has one signature:
.innerWidth()Retrieve the currently computed CSS width of the first element within the matched set including padding, but not border or margin.
The .offset() method has three signatures:
.offset()Retrieve the current coordinates from the first element within the matched set relative to the document.
.offset( coordinates )Set the current coordinates within the matched set, relative to the document.
.offset( function(index, coordinates) )Execute a function returning the coordinates to set, relative to the document.
The .outerHeight() method has one signature:
.outerHeight( [includeMargin] )Retrieve the currently computed CSS height for the first element in the set of matched elements, including padding, border, and optionally margin.
The .outerWidth() method has one signature:
.outerWidth( [includeMargin] )Retrieve currently computed CSS width for the first element in the set of matched elements, including padding, border, and optionally margin.
The .position() method has one signature:
.position()Retrieve the current coordinates of the first element within the matched set, relative to the offset parent.
The .scrollLeft() method has two signatures:
.scrollLeft()Retrieve currently computed CSS width from first element within the matched set.
.scrollLeft( value )Set the currently computed CSS width from the first element within the matched set.
The .scrollTop() method has two signatures:
.scrollTop()Retrieve current vertical position of scroll bar for the first element in the matched set.
.scrollTop( value )Set current vertical position of scroll bar for the first element in the matched set.
The .width() method has three signatures:
.width()Retrieve currently computed CSS width from the first element within the matched set.
.width( value )Set the CSS width of each element within the matched set.
.width( function(index, value) )Execute a function returning the CSS width to set.