words

Refactoring jQuery call

// v1
var btn = $('#showPlayer');
(state !== -1) ? btn.show() : btn.hide();

// v2 That's more badass:
$('#showPlayer')[(state !== -1) ? "show" : "hide"]();

// v3 even better (only when `state` is a Boolean, not now):
$('#showPlayer').toggle(state);
Last updated: