Hide an element with jQuery/javascript when the user is logged in
Hi All,
I would like to hide a menu item when the user is logged in already, here is my code but it doesn`t work properly:
I am checking if the user is logged in - (the top line works as it displays the alert message if I add one), but for some reason it doesn`t hide the menu item and the megamenu looks messed up when the user is logged in.
What would be the correct way to hide it?
Thank you
- function hideing() {
- if ($('#dnn_dnnUser_enhancedRegisterLink:contains("SuperUser Account")').length > 0) {
- document.getElementsByClassName['ul.megamenu li.level0:nth-child(4) .sub ul.megamenusubcontent:nth-of-type(1) li.subheader a'].style.visibility = hidden;
- }
- }