Error with jQuery inclusion at top of page
Opened this issue · 1 comments
Hello,
I'm developing a quiz and I've got an error with the inclusion of jQuery. In my current web application, I included jQuery directly in the includeJS {} with a jquery.forceOnTop = 1, this was necessary for technical reasons.
Currently, I am facing a problem, from ‘fp_masterquiz/Resources/Private/Templates/Quiz
/Show.html", I get an error at “var form = $(”#quiz-form'+ceuid);", the console tells me "Uncaught TypeError: $ is not a function’.
Why does this trigger this error even though jQuery is loaded correctly at the top of the page? If I include jQuery directly in the footer, then it works.
I'm using the extension in version 3.7.1, TYPO3 in version 11.5.36 and jQuery in version 3.5.1.
Thanks in advance
That must mean, that jQuery is not loaded yet. I don´t know why not.
You could change the template and add the document.addEventListener('DOMContentLoaded' around the jQuery-Code:
document.addEventListener('DOMContentLoaded', function(){ var form = $(”#quiz-form'+ceuid); ... }, false);
In that case the code is executed only after the site is loaded...