+ 1
Why is jQuery not working in the JavaScript section of SoloLearn?
For some reason, SoloLearn won’t let me use jQuery unless I open up a <script> tag I the HTML. Oh, and by the way. https://code.sololearn.com/WmBL08hEGpBY/?ref=app
11 Antworten
+ 3
In jQuery, it is
$(document).ready(function(){
...
}
Shorthanded :
$(function() {
...
}
Which are in second and third page in the "getting started" above.
Reason is, js tab scripts are put in head and compiled before body.
Your way of putting js script before end of body is another way ensure successing DOM assignment.
+ 3
Jquery works in the JavaScript section. See this :
https://code.sololearn.com/Wm198S0Ra8Xc/?ref=app
+ 2
Yes that is importing library.
+ 2
You are referencing DOM
Have you wrap your js codes in window.onload when you put your scripts in the JS tab?
+ 2
I am sorry too. I misunderstood your question in the first place.
+ 1
https://www.sololearn.com/learn/jQuery/2785/
I checked your profile. You have completed jQuery course so you should know that you must import the jQuery library in order for the jQuery syntax to function.
Please do not spam the Q&A section. Thanks
Not to do on Sololearn Q&A
https://code.sololearn.com/W26q4WtwSP8W/?ref=app
+ 1
Gordon
I am including it in my head.
+ 1
Arushi Singhania
It used to work like that for me but it doesn’t anymore.
+ 1
Gordon
Thank you! It worked after the code was wrapped with the “$(function(){...})” .
:)
I’m sorry, I can delete the thread if you please.
0
Gordon
I just said that I have imported the library but it only lets me use jQuery if I open up a script tag in the HTML.