I want to make a few "special" pages in Sharepoint 2010, that hides the menu and ribbon from the Masterpage.

Is it possible to write JQuery code in a web part that can hide/disable/delete some masterpage elements?

Anyone have some tips or resources to how to achieve that?

2 Answers 2


Sure you can, almost all of the elements from the masterpages has an id and / or multiple classes that can help you identify them with jQuery.

Use the Content Editor WebPart and add your scripts in the HTML window of the webpart.

To identify the ID:s for specific elements in the DOM I recommend you to just inspect the page with the developer tools in your browser (e.g just hit F12 in IE or Chrome)

Then you could just select them with jQuery and hide them like:


but using a correct ID or Class for the element you want to hide.

Just make sure that your functions are not executed until the DOM ir ready by attaching it to the jQuery.onload like this:


or without creating the function separetely:


write javascript on page or place content editor webpart on page and linkup with your js

<script src="jquery file path" type="text/javascript"></script>
<script type="text/javascript">
// do whatever operations with any element

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.