jQuery code to JavaScript : <pre><code>$(function () {
    $(document).on('click', 'td', function () {
        $(this).toggleClass('active');
    });
});
</code></pre>

<p>Can someone please show what this code would be in vanilla javascript?</p>

<p><a href="https://stackoverflow.com/questions/22105868/difficulty-changing-dynamically-generated-table-cell-background-onclick/50448074#50448074">Difficulty changing dynamically generated table cell background onclick</a></p>
