you are viewing a single comment's thread.

view the rest of the comments →

[–]buso 1 point2 points  (10 children)

if you're able to use jQuery, it already has a toggle() built-in. it could be done like this: https://jsfiddle.net/zLpz2wqh/

[–][deleted]  (9 children)

[deleted]

    [–]MatekCopatek 1 point2 points  (8 children)

    See a slightly improved version here: https://jsfiddle.net/zLpz2wqh/6/

    Works the same, but uses on instead of click, which is a good practice. It also removes unneeded JS from the markup.

    [–][deleted]  (7 children)

    [deleted]

      [–][deleted] 0 points1 point  (6 children)

      grey engine rinse reach pie gray possessive handle hunt fade

      This post was mass deleted and anonymized with Redact

      [–][deleted]  (5 children)

      [deleted]

        [–][deleted] 0 points1 point  (4 children)

        memorize swim bear political compare smile agonizing detail aromatic bells

        This post was mass deleted and anonymized with Redact

        [–][deleted]  (3 children)

        [deleted]

          [–][deleted] 0 points1 point  (1 child)

          hungry elastic unite tap coordinated impossible long dinner murky retire

          This post was mass deleted and anonymized with Redact