Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with jQuery inclusion at top of page #57

Open
e-chauvet opened this issue Apr 30, 2024 · 1 comment
Open

Error with jQuery inclusion at top of page #57

e-chauvet opened this issue Apr 30, 2024 · 1 comment

Comments

@e-chauvet
Copy link

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

@bihor
Copy link
Owner

bihor commented May 2, 2024

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants