Ask coding questions

← Back to all posts
ReferenceError: $ is not defined ( Jquery is not recognized )
DidierCAS

Hello, i have put the script Jquery at the top of my html file, but still it shows up this reference error in my console, when i run it. Could you help me out please? See my REPL in link

Voters
YisanAndyAndy
DidierCAS
Comments
hotnewtop
Vandesm14

You need to move your jquery include to line 19 since the rest of the scripts are loaded there.

DidierCAS

@Vandesm14 i have tried it, i still get the error.

Vandesm14
DidierCAS

@Vandesm14 I tried your solution, it s kind the same as me like @niorg2606 suggested but i have still this issue : my console.log doesnt get printed, meaning everything inside my submit doesnt get called in fact.

I have tried to put :

$("#submit").submit(function(event) {
event.preventDefault();
console.log("newtodo event");
});

But no result too in the console

Vandesm14

@DidierCAS Actually, forking the repl again, it works fine for me. Try forking it yourself, if you didn't already. I'll keep looking for an answer if this is not the case.

DidierCAS

@Vandesm14 I forked your solution, still when i click "Valider" I get nothing on console :s.

I tried to copy these 2 files on my local, and run Chrome i get nothin on console again. THe submit redirects me to '/' because i have action set to '/'. So submit() works but not the content

Vandesm14

@DidierCAS This is such a weird case. Can you invite me to multiplayer for the repl and DM me on Discord (if you have it): Vandesm14#3364

SixBeeps

Try putting the contents of the script inside the script.js file.

DidierCAS

@niorg2606 I copy the source code of jquery into script.js and imported it, now i dont have anymore the error :), but it does not console.log what i expected gonna have to think on that now..