JSFiddle - React, Tailwind, and code Playground

by maremp

HTML

<div class="addlink" data-status="post123">
    add link
</div>

<div class="mar-post123">
        Click me
    </div>
    
    <div id="statusfor-post123">
        Status
    </div>

CSS

div {
    margin-top: 10px;
    cursor: pointer;
}

[class|=mar] {
    background: whitesmoke;
    cursor: pointer;
}

.finished-reading {
    background: grey;
}

JavaScript

jQuery(".addlink").click(function(){
    var post_id = jQuery(this).attr("data-status");
    jQuery(".mar-"+post_id).click(function() {
        jQuery("#statusfor-"+post_id).toggleClass( "finished-reading" );
    });
});