I've come across a plugin to toggle checkboxes (https://github.com/designmodo/Flat-UI/blob/master/js/flatui-checkbox.js).
However, it doesn't work properly with the latest version of jQuery so I'm having to debug it.
Can anyone explain the following?
if ($el.prop('disabled') == false) {
$parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.attr(ch, true);
$el.trigger(e).trigger('change');
}
Specifically, what is the deal with the &&
? I know this is an AND operator, but I thought these only existed within if
statements.
And also, what does the dollar in $el
mean? It is set like this: $el = $(element)
. I understand why it's needed on the right but don't know what point it serves on the left.