JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="teste" />

JavaScript

var getInput = function (methodID) {
  var input = document.querySelector("input");
  console.log(methodID + " - input: " + (input ? input.name : "not found"));
}

getInput(1);
(function () {
  getInput(2);
})();

document.addEventListener("readystatechange", function () {
	if (document.readyState == "interactive") {
    getInput(3);
  }
})