CSS Flip animation on click
<p>I am following the <a href="https://davidwalsh.name/css-flip" rel="nofollow">example David Walsh</a> provides to make a flip animation. Its is all working on hover, however, I want to flip the element on click as opposed to on hover.</p>

<p>The following code works and flips the element on hover, however, I want to use javascript/jquery to implement this. I have tried many different ways but cannot figure out how to do this.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.flip-container {
    perspective: 1000px;
}
.flip-container:hover .flipper,
.flip-container.hover .flipper {
    transform: rotateY(180deg);
}
.flip-container,
.front,
.back {
    width: 320px;
    height: 480px;
}
.flipper {
    transition: 0.6s;
    transform-style: preserve-3d;
    position: relative;
}
.front,
.back {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
}
.front {
    z-index: 2;
    transform: rotateY(0deg);
}
.back {
    transform: rotateY(180deg);
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="flip-container" ontouchstart="this.classList.toggle('hover');"&gt;
    &lt;div class="flipper"&gt;
        &lt;div class="front"&gt;
            1
        &lt;/div&gt;
        &lt;div class="back"&gt;
            2
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;</code></pre>
</div>
</div>
</p>