JSFiddle - React, Tailwind, and code Playground

by joshmoto

HTML

<a onclick='undo(event)'>Undo</a>

<ul class="scores">
<li data-round="0">0</li>
<li data-round="1">1</li>
<li data-round="2">2</li>
<li data-round="3">3</li>
</ul>

JavaScript

undo = function(e) {

    var round = $('.scores li:last-child').data('round');

    console.log(round);

    // if(round >= 0) {
    //
    //     $('#' + id + ' .scores li:last-child').remove();
    //
    //     total_score(id);
    //
    // }

    // prevent form defaults
    e.preventDefault();

};