JSFiddle - React, Tailwind, and code Playground
by shivaay123
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Check/Uncheck Checkbox</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function() {
$(".clickCheck").click(function() {
$("#chechId").attr("checked", true);
});
$(".clickUncheck").click(function() {
$("#chechId").attr("checked", false);
});
});
</script>
</head>
<body>
<p><input type="checkbox" id="chechId"> Are you interested in sports?</p>
<button type="button" class="clickCheck">Yes</button>
<button type="button" class="clickUncheck">No</button>
<p><strong>Note:</strong> Click the buttons to check or uncheck checkbox.</p>
</body>
</html>