My CSS is using a data attribute, but when I try to change it with jQuery, the change is not reflected on the screen or in the DOM.
$('#new-1').data('count', 5);
.fa-stack[data-count]:after {
position: absolute;
right: -20%;
top: -20%;
content: attr(data-count);
font-size: 90%;
padding: .4em;
border-radius: 999px;
line-height: .75em;
color: white;
background: rgba(255, 0, 0, 1);
text-align: center;
min-width: 1.5em;
font-weight: bold;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<span id="new-1" class="fa-stack fa has-badge" data-count="0">
<i class="fa fa-user-circle fa-stack-1x"></i>
</span>