Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Hide all elements of a class in a dom using jquery

I am trying to hide all elements of classing in a dom using jquery.

In my case this works:

document.getElementsByClassName('hc-block hc-theme-nice-link hc-nowrap')[6].style.visibility='hidden'

but I want to hide all the elements (not just the 7-th one) and I would like to use Jquery

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Tried this:

$(".hc-block hc-theme-nice-link hc-nowrap").css("visibility", "hidden");

but it does not work… Really dont understand why???

>Solution :

Your jquery selector will need class to define with ., and you want to select element with all mentioned class so do not add space between them. Try like below.

$(".hc-block.hc-theme-nice-link.hc-nowrap").css("visibility", "hidden");
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading