Hide/show element with a boolean
Yes there is!
$element.toggle();
Without any parameters, toggle
just toggles the elements visibility (I don't mean the visibility
property) and depends on the current state of the element.
$element.toggle(display);
If you call toggle
with a boolean parameter, element is shown if it is true
and hidden
if it is false
source
Apparently you can just pass a boolean to the toggle
function
$element.toggle(shouldElementBeVisible)