+ 1
What the F is going on?!!
Hello, My name is Jesse Koops and I want to be a freelance graphic, web and ui-designer. Im a bit of a noob When working with JavaScript and Im trying to learn the basics of it and other programms like PHP with this app And it’s community. Now my first question to this community is: Why won’t my hamburger icon open Its content? I inserted my code here: https://code.sololearn.com/WKzZu3MHVGDg/?ref=app
7 ответов
+ 5
Hi Jesse Koops,
If you want to implement JQuery in your code then it is recommended to use the JQuery library otherwise the code wont execute.
Paste this between your head tags if you want to use JQuery:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
+ 3
Your link isn't to an image so it is not recognized and therefore can't be displayed.
+ 1
You need to insert the jquery library so you can use it. You can Google it there is ton of videos who explain this very well
+ 1
John Wells thanks John!
+ 1
Jesse Koops,
Since you gave the submenu a display of none, you need to display it with jquery to show after click.
$("#item").on("click",()=>{
$("#submenu").toggle(()=>{
$("#submenu").css({
display: "block"
});
});
});
Hope this helps👍
Additional:
https://www.w3schools.com/CSSref/pr_class_display.asp
+ 1
Jesse Koops,
Excuse me!
I totally forgot to smention that SoloLearn implements the javascript in the head tags. Therefore you need to get the DOM first before the JS can be executed.
In this case the
window.onload / document.onload
is called when the DOM is ready.
Have a look at the changes👍😊
https://code.sololearn.com/W3eG5IecB9Q7/?ref=app
0
🌴Vincent Berger🌴 Did that but it didnt work in my output. Do I also need to put the content from the link in my javascript page?