Skip to content
Justice Tech School

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

Which is for checked state?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.