JSFiddle - React, Tailwind, and code Playground

HTML

<input id="foo" value="bla" />

JavaScript

alert($('#foo').val()); // undefined - the DOM isn't ready yet.

$().ready(function() {
    alert($('#foo').val()); // bla - the DOM is ready now.
});