JSFiddle - React, Tailwind, and code Playground

by hodca

HTML

<p bgcolor="asdf" id="demo">Click the button to change the text in this paragraph.</p>

<button onclick="myFunction()">Try it</button>

JavaScript

function myFunction() {
console.log( document.getElementById("demo").getAttribute("bgcolor"));
    document.getElementById("demo").innerHTML = document.getElementById("demo").getAttribute("bgcolor");
 
}