JSFiddle - React, Tailwind, and code Playground
HTML
<a href='#' onclick='ListAll()'>List Attributes!</a>
<br>
<br>
<div id="sample" title="sample title attribute" myattr="myattrval"></div>
<div id="log" style='border:1px solid black; width: 300px;'>Empty</div>
JavaScript
//function ListAll() {
var result = "";
$.each(document.getElementById("sample").attributes, function(k, v){
result += ( v.name + "=" + v.value + "<br>");
});
$("#log").html( result );
//}