JSFiddle - React, Tailwind, and code Playground

HTML

<div id="div1" style="width:80px;height:80px;background-color:silver;" >
<span id="sp1" data-value="23">
</span>
</div>

JavaScript

$(document).ready(function(){
    function loadDivAttribute(){
    	var valor = $("#sp1").attr("data-value");
        console.log(valor);
        alert(valor);
         $("#sp1").attr("data-value", 30);
    }
    
    loadDivAttribute();
});