DEV Community

Avnish Jayaswal
Avnish Jayaswal

Posted on

Setting “checked” for a checkbox with jQuery

You can check or uncheck a checkbox element or a radio button using the .prop() method:


// Check #x
$( "#x" ).prop( "checked", true );

// Uncheck #x
$( "#x" ).prop( "checked", false );

⭐ Football Update: askavy/setting checked for a checkbox with jquery gfe - Info Live Streaming 2026 ⭐ Football Update: askavy/setting checked for a checkbox with jquery gfe - Info Live Streaming 2026

f you’re working with just one element, you can always just access the underlying HTMLInputElement and modify its .checked property


$('.x')[0].checked = true;
$('.x')[0].checked = false;

⭐ Football Update: askavy/setting checked for a checkbox with jquery gfe - Info Live Streaming 2026 ⭐ Football Update: askavy/setting checked for a checkbox with jquery gfe - Info Live Streaming 2026

jQuery 1.5.x and below

$('.x').attr('checked', true);
$('.x').attr('checked', false);

⭐ Football Update: askavy/setting checked for a checkbox with jquery gfe - Info Live Streaming 2026 ⭐ Football Update: askavy/setting checked for a checkbox with jquery gfe - Info Live Streaming 2026

Read More : Setting “checked” for a checkbox with jQuery

Top comments (0)