Drop down menus using javascript

i am trying to understand basic menus with onclick event.
i am trying to get element by id and name the element.
Does css effect the ability to grab an element as i have spent the last week trying to figure out how to grab an element and nothing i am doing with allow be to affect change of an element, its like it won’t even grab the element ?

I am doing it as part of an assignment for college, but im getting no help from the teacher just sent on my merry way as someone with no experience in javascript
and attempting to hide a menu in a basic way
i was trying document.getElementById(“idname”).style=“visibility : hidden”; and nothing changes on the page.
i know that the css is linked up correctly as it shows when i load the page,
I know that the javascript is linked correctly to html as well as i have typed each letter word for word

the css selectors are only defining the size and colors of the side menu and nothing else but anything i do doesnt work with javascript
would anyone be able to help with advice on what i might be doing incorrectly?

Shouldn’t this be

document.getElementById("idname").style.visibility = "hidden"; 


1 Like

I tried it that way aswell?
I don’t know what my mistake is :slightly_frowning_face:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.