jQuery Attributes Methods

Beginner
6 min read
Updated: Nov 2026
5 method guides
Method index

About This Index

This page is the jQuery Attributes index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

Learn the jQuery overview on /jquery. Use this page when you need an Attributes API such as .attr(), .prop(), or .val().

Beginner path.

Start with .attr(), then .prop() and .val()—use .removeAttr() when you need to strip markup attributes.

How to Call an Attributes Method

Getters read the first match; setters update every matched element:

jQuery
$("a").attr("href");                 // get
$("a").attr("href", "/docs");         // set
$("img").attr({ alt: "Logo", title: "Home" });

$("input").prop("checked", true);     // live property
$("input").prop("disabled");          // boolean

$("input[name=q]").val();             // get form value
$("select").val(["a", "c"]);          // multi-select

$("div").removeAttr("title");
$("div").removeProp("myCustomFlag");

jQuery Attributes Methods Table

All Attributes method guides in this jQuery tutorial series (5 tutorials).

Get & Set

3 methods

Read and write HTML attributes with .attr(), live DOM properties with .prop(), and form values with .val().

MethodDescriptionTutorial
.attr()Get or set HTML attributes — href, src, title, alt, id; use .prop() for checked, selected, and disabled.Try it
.prop()Get or set live DOM properties — checked, disabled, selectedIndex; use .val() for form field values.Try it
.val()Get or set form values on input, textarea, and select — multi-select returns an array.Try it

Remove

2 methods

Strip markup attributes and custom properties — .removeAttr() for HTML, .removeProp() for .prop() cleanup.

MethodDescriptionTutorial
.removeAttr()Remove one or more HTML attributes from every matched element (space-separated names since 1.7).Try it
.removeProp()Remove a property previously set with .prop() — not for native checked/disabled; prefer .prop(name, false).Try it

Frequently Asked Questions

They get and set DOM attributes and related values: .attr() for HTML attributes, .prop() for live properties, .val() for form field values, plus .removeAttr() and .removeProp() to clear them.
Use .attr() for markup attributes (href, src, title, alt, id). Use .prop() for live form state—checked, selected, disabled—and other DOM properties that change at runtime.
No. The getter .attr(name) reads only the first match. Setters (name/value, object, or callback) apply to every matched element.
Call .removeAttr('title') or .attr('title', null). For boolean form state, prefer .prop('checked', false) instead of removing the attribute.
Start with .attr(), then .prop() and .val(). Add .removeAttr() when you need to strip markup attributes.

Start with .attr()

Open the attributes guide—syntax, examples, and FAQs.

.attr() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

16 people found this page helpful