Checkbox checked or not

This is demo for checkbox checked or not when click on any link or any button.

by Divyesh Patel

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<input type="checkbox" id="check">
<a href="#" onclick="check()">click</a>
<button onclick="check()">
button
</button>
<script>
 function check() {
    		if (document.getElementById('check').checked) {
            alert("checked");
        } else {
            alert("You didn't check it! Let me check it for you.");
        }
       
    }

</script>