I have the folowing problem:
My site is loading jQuery in the head section. It has the "async" flag so it's loading asynchronisly. I have written some functions using jQuery und manipulating the content.
When I implement this functions at the end of the jQuery file, sometimes jQuery is loaded before the whole DOM of the website. That means my functions cannot find the special elements and don't do anything. If I implement this funktions at the end of the HTML file, when the DOM is already loaded, it happens that the webpage is finished but jQuery not. Then I get the error that the jQuery reference is not defined.
Has anyone an idea how i can fix this dilemma? Loading JS asynchronisly and calling functions, when DOM and JS file has been loaded?
Thanks, Jens