Skip to content
Advertisement

How to get sibling element by its class name and then hide it using Javascript only?

I have this html structure:

JavaScript

i want to hide the element with class named content given the sibling element id which is xyz , in jQuery i can easily do it like this:

JavaScript

how can i achieve the same thing using pure Javascript only ?

Advertisement

Answer

JavaScript

jsfiddle

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement