pretty-checkbox
pretty-checkbox copied to clipboard
The items toggles on and off visually but not checked true or false
The items toggle on and off visually but it doesn't change the state of the checkbox why and how do we achieve that?
The value of the checkbox's checked property does change to either true or false, in addition to the "visual" representation you're seeing. You can check this in the console by selecting the input's element and then logging the ".checked" property. It will have a value. The library is accomplishing this "purely" through css via the checked pseudo element. You can read about that here: https://developer.mozilla.org/en-US/docs/Web/CSS/:checked.
I was confused by this at first too. You might expect to see a "checked" attribute on the input. But with this lib you won't.
i use onclick="console.log($(this).is(':checked'))"
in the radio or checkbox element, its working