Hacker News new | ask | show | jobs
by mschuster91 868 days ago
> Gotta love that "modern" triple attribute repetition.

You can golf it down a bit:

    el.style.display=el.style.display == 'none' ? '' : 'none';
3 comments

Surely

    el.style.display = el.style.display ? 'none' : ''
(after toggling we've already obliterated any possible third value for it anyway, doesn't seem significant)
Even though I can appreciate the elegance of your solution, I'd prefer the former for clarity.
Of course. Because that's infinitely better than:

  $(el).toggle();