Issue on Checking Check box State On click (Checked or Un Checked)

Issue on Checking Check box State On click (Checked or Un Checked)

I am using a Bootstrap Switch component instead of core html check box and I am having issue on getting the state of the check box on click. Can you please take a look at This Demo and let me know how I can enable my code to get the state of the checkbox change and alert in different states?

  1.  $(document).ready(function () {
  2.      $("[data-toggle='switch']").wrap('<div class="switch" />').parent().bootstrapSwitch();
  3.      $('#test').click(function () {
  4.          if ($('#chkSelect').attr('checked')) {
  5.              alert("Is Checked");
  6.          } else {
  7.              alert("Is Un Checked");
  8.          }

  9.      });
  10.  });
Thanks