Attributes and Properties
attr reads and writes attributes. prop is for live properties like checked. data reads data attributes.
Example
$('a').attr('href', '/home');
$('#c').prop('checked', true);
$('#item').data('id');Exercise
Property for a checkbox.
$('#c').('checked', true)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.