JSFiddle - React, Tailwind, and code Playground

by shanieMoonlight

HTML

<!DOCTYPE html>
<html>

  <head>
    <title>Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
      function codeAddress() {
        alert('ok');
        console.log(654)
      }
      window.onload = codeAddress;

    </script>
  </head>

  <body>

    <input type='file' accept='text/plain' onchange='openFile(event)'>
  </body>

</html>

JavaScript

async function openFile (event) {
  const file = event.target.files[0]
  const obj = [await new Response(file).json()]
  console.log('obj', obj)
}



window.onload = function() {
  yourFunction(param1, param2);
};