gitbrent / bootstrap4-toggle

Bootstrap 4 Switch Button / Toggle
https://gitbrent.github.io/bootstrap4-toggle/
MIT License
213 stars 67 forks source link

I can't validate if the toggle is checked #43

Closed RamsesSerna closed 4 years ago

RamsesSerna commented 4 years ago

I'm having this trouble.

I'm traying to verify if the checkbox is checked when the element changes but the element never change it state. Here is the code:

$('#ws_swtch').change(function (e) {
  e.preventDefault();

  if ($(this).is(':checked')) {
    $('#col_url').removeClass('oculto');
    $('#col_catalogo').addClass('oculto');
   } else {
    $('#col_catalogo').removeClass('oculto');
    $('#col_url').addClass('oculto');
   }
});