JSFiddle - React, Tailwind, and code Playground

by charaf11

HTML

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

JavaScript

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

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

});