checkbox default value and checked value get in jquery

Solutions on MaxInterview for checkbox default value and checked value get in jquery by the best coders in the world

showing results for - "checkbox default value and checked value get in jquery"
Marie
08 Jul 2019
1//selected checkbox alert boolen value return
2$('#test').click(function() {
3    alert("Checkbox state (method 1) = " + $('#test').prop('checked'));
4    alert("Checkbox state (method 2) = " + $('#test').is(':checked'));
5});
6<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
7Check me: <input id="test" type="checkbox" />
8  //@sujaY