Cybacor
Cybacor

Reputation: 1

Hiding specific menu items

I am trying to hide menu items where they contain the word 'Benefits HIDDEN' in a quick launch list. I have been trying to get a script to work, but no avail so far. Using F12 in Edge, the class I want to hide is as follows;

<span class="menu-item-text">Benefits HIDDEN</span>

Which sites under this DIV

<div class=" noindex ms-core-listMenu-verticalBox" id="zz13_idPDPQuickLaunch">

I was trying this kind of approach;

<script>
$(document).ready(function() {
    $(".zz13_idPDPQuickLaunch *:contains('Benefits HIDDEN')").hide ();
});
</script>

But no luck!

Upvotes: 0

Views: 90

Answers (2)

Amos
Amos

Reputation: 2091

You can use the class/id of element you want to hide as the main part of jQuery selector. If you want to hide the li tag, you can use(static is the class of the li tag):

$(".static:contains('Benefits HIDDEN')").hide();

enter image description here

Best regards,

Amos

Upvotes: 0

Darma
Darma

Reputation: 113

zz13_idPDPQuickLaunch is ID not a class, use # eg:

<script>
$(document).ready(function() {
    $("#zz13_idPDPQuickLaunch *:contains('Benefits HIDDEN')").hide ();
});
</script>

Upvotes: 1

Related Questions