JSFiddle - React, Tailwind, and code Playground

HTML

<input type='checkbox' onclick='changeText()' id='check'/>
<p><a class="checkbox" href='#'>add to cart</a></p>

JavaScript

$('#check').change(function(){

if ($(this).is(":checked")) $(this).next().text('added');
 else $(this).next().html("<a href='#'>add to cart</a>");

});