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

Execute CSS inside jQuery only if body class exists

i’m trying to execute css (display: none;) inside script to hide elements from my menu only if one language is active so the body class changes from one language to another and i want the script to check if the body class of X language active to execute css display none else display block.
i already tried it in at the bottom of the footer and i don’t know what let it happens, just do not work…

$('body').hasClass('translatepress-ru_RU') {
  $("#menu-item-17728").css("display","none");
}

>Solution :

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

You can do this with css.

body.translatepress-ru_RU #menu-item-17728{
    display:none;
 }
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