JSFiddle - React, Tailwind, and code Playground

by Chinh Phan

HTML

<!DOCTYPE html>
<html>
<body onclick="myFunction()">

<p>Click anywhere in the document to display the active element.</p>
<input type="text" value="An input field 1">
<input type="text" value="An input field 2">
<input type="text" value="An input field 3">
<input type="text" value="An input field 4">
<input type="text" value="An input field 5">
<button>A Button</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.activeElement.value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>