Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
jQuery

Get and Set Attributes in jQuery

Use .attr() for HTML attributes and .prop() for DOM properties.

Get and Set Attributes in jQuery — a practical guide to jQuery attr prop with clear examples you can reuse in real projects.

jQuery Tutorial Series (38/101). Prefer one article? Read the complete jQuery tutorial.

Short description

checkbox checked → .prop("checked"); href → .attr("href").

attr / prop

$('a').attr('href', '/home');
$('#agree').prop('checked', true);

Leave a reply

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