JSFiddle - React, Tailwind, and code Playground

HTML

<button>Click here</button>
<div id="subscribers">This will be added to</div>
<div id="getAttr"></div>

CSS

button {
    border: 1px solid #444;
    background: #efefef;
    cursor: pointer;
    padding: 5px;
}

#subscribers {
    background: #ffc;
    border: 1px solid #ccc;
}

#subscribers, #getAttr {
    margin: 30px;
    padding: 10px;
}

.added {
    background: #ccc;
    border: 1px solid #444;
}

JavaScript

$(function() {
    $('button').on('click', function(e) {
        //found that either the attr() or the prop() could work
        $('#subscribers').attr('title','I am a title');
        /*$('#subscribers').prop('title', function() {
           return ('I am a title');         
        });*/
        
        //just for visual feedback
        $('#subscribers').css('border','1px solid #000');
        
        //show me the attr that was set
        var title = $('#subscribers').attr('title');
    });
    
    
});