javascript - a jQuery show() that accepts a value? -
is there shorter way write this?
if (somebool) { $dom.show(); } else { $dom.hide(); }
jquery's toggleclass function can called toggleclass('class', somebool)
add or remove class depending on value of somebool. i'm looking function in jquery showing/hiding elements.
it similar toggleclass
:
$('selector').toggle(somebool);
Comments
Post a Comment