+ 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.
9 Réponses
+ 5
# for id
for example $("#T")
those list element should all be li not ln
<li>.... </li>
+ 1
#T{
display:none;
}
+ 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
+ 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
+ 1
great, best of luck with your learning.
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
0
Gordon omg... I litterally tried that yesterday but i just tried again and it worked. Thank you
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
0
Thank you for help... Im going to work on finishing the css course today btw Gordon