JSFiddle - React, Tailwind, and code Playground
HTML
<form class="tasklist">
Those are your tasks for today
<label>
<input class="task" type="checkbox">
This is a task that was added by the user
</label>
<label>
<input class="task" type="checkbox">
This is a task that was added by the user
</label>
</form>
JavaScript
$('input.task').click(function(){
var checkbox = $(this);
var form = $(this).parents('form');
if (checkbox.prop("checked")) {
checkbox.parent().css('text-decoration', 'line-through').fadeOut(1000, function(){
checkbox.parent().remove();
if(form.children().length == 0) {
form.remove();
}
});
}
});