data
Obtain the dataset of an element, use the data
property to maintain consistency with the native dataset.
<script src="https://cdn.jsdelivr.net/gh/kirakiray/ofa.js@4.5.26/dist/ofa.min.js"></script>
<style>
[data-red="1"]{
color:red;
}
</style>
<div id="target" data-one="I am one">origin text</div>
<br>
<h4>logger</h4>
<div id="logger" style="border:#aaa solid 1px;padding:8px;"></div>
<script>
setTimeout(()=> {
$("#logger").text = $("#target").data.one;
$('#target').data.red = "1";
}, 1000);
</script>