How do i make my javaScript work in this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do i make my javaScript work in this code?

https://code.sololearn.com/WISv6hvTGTb2/?ref=app The function name is $, and its called right away. When its called then its supposed to make the word "hi" invisable and when you click "base 10" under "default base" its supposed to toggle it visable and invisable but thats clearly not working.

17th Nov 2019, 1:15 AM
pixel strength
pixel strength - avatar
9 Answers
+ 5
# for id for example $("#T") those list element should all be li not ln <li>.... </li>
17th Nov 2019, 1:49 AM
Gordon
Gordon - avatar
+ 1
#T{ display:none; }
17th Nov 2019, 3:19 PM
Gordon
Gordon - avatar
+ 1
You are welcome I clicked into your profile. While Bootstrap is a responsive design framework for fast production, I think it is good for you to finish the SoloLearn CSS course first, because it helps you know the fundamentals. For jQuery, it is less useful now. For example, the toggle() method, we now have classList.toggle() in vanilla JavaScript, which doesn't only toggle display, but any styles you defined in the toggling class. https://www.sololearn.com/post/137835/?ref=app Finally, for what you want to achieve, you don't need to add event listener one by one, you can do it with event delegation https://code.sololearn.com/WKip4OTCKHdd/?ref=app
17th Nov 2019, 3:30 PM
Gordon
Gordon - avatar
+ 1
put <li> in <ul> or <ol> add a <div> as container for each list, add class names, set position absolute with different left https://code.sololearn.com/WpgaPBsGtd78/?ref=app
17th Nov 2019, 3:49 PM
Gordon
Gordon - avatar
+ 1
great, best of luck with your learning.
17th Nov 2019, 4:00 PM
Gordon
Gordon - avatar
0
Got it Gordon... I updated the code and now im wondering, ive tried calling the function in js but cant seem to make it work. How do i make the word hi invis by default? It already toggles correctly btw
17th Nov 2019, 2:36 PM
pixel strength
pixel strength - avatar
0
Gordon omg... I litterally tried that yesterday but i just tried again and it worked. Thank you
17th Nov 2019, 3:25 PM
pixel strength
pixel strength - avatar
0
Thats cool, but i do have one more problem now. "Base 10" under both drop down menu's shows some text on click... When i have both displayed, how do i make them the same vertical position? Ive tried changing margin-top but doesnt seem to work how i want. Thx for all the help
17th Nov 2019, 3:37 PM
pixel strength
pixel strength - avatar
0
Thank you for help... Im going to work on finishing the css course today btw Gordon
17th Nov 2019, 3:52 PM
pixel strength
pixel strength - avatar