Attaching the jQuery does not work? Anyway to fix it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Attaching the jQuery does not work? Anyway to fix it?

7th Feb 2017, 9:00 AM
Remco
Remco - avatar
7 Answers
+ 5
Could you post the error?
7th Feb 2017, 11:26 AM
Kamil
Kamil - avatar
+ 5
this works for me, try it: <!DOCTYPE html> <html> <head> <title>Page Title</title> <script src="https://code.jquery.com/jquery-3.1.1.js"></script> <script> $(function() { var b = $("body"); b.html("hello"); }); </script> </head> <body> </body> </html> [edit]: forgot to close the head tag, now everything works
7th Feb 2017, 3:25 PM
Kamil
Kamil - avatar
+ 5
just so it's easy to copy paste, however it's better to put it in the "js" tab
7th Feb 2017, 3:28 PM
Kamil
Kamil - avatar
+ 5
lol I'm sorry, looks like I forgot to close the head tag now everything should work fine🖒
7th Feb 2017, 3:34 PM
Kamil
Kamil - avatar
+ 2
So you put the jquery script in the html?
7th Feb 2017, 3:27 PM
Remco
Remco - avatar
+ 1
I just do what is in the course: add the link to the library in the html and then I create a js file and add that to the html as well but if I try to use the dollar sign it says the variable is not assigned
7th Feb 2017, 3:19 PM
Remco
Remco - avatar
+ 1
tnx I'll try that
7th Feb 2017, 3:26 PM
Remco
Remco - avatar