Problems with toggle checkbox(Switchery)

Asked

Viewed 15 times

0

Good Tade, I have a problem adding the checked attribute to checkbox.

I have knowledge in Jquery and I’ve done it many other times, but I’ve never used Switchery, I don’t know if that’s the problem, but I’ll leave the code down below.

// JQuery
if(data.is_not_found == 1){
    $('#cbxNotFoundMessage').attr("checked", "checked");
}
  • Have you tried that: $('#cbxNotFoundMessage').attr("checked", true);

  • Yeah, it’s not working that way either

1 answer

0

My friend, this way it won’t work even because the attribute checked has no value !

$('#cbxNotFoundMessage').attr('checked','');

that would be the right one.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.