I am working on a team site, where i have a custom list, and for this custom list i am enabling the Quick Edit option, so on the list views i will get this inside the tool bar:-

enter image description here

now i added this list inside our site home page as a web part, so i got this option also inside the tool bar:-

enter image description here

now i want to hide the following markup "or edit this list" inside the webpart tool bar, and keep the tool bar as is inside the list views. now the problems i faced is that, if i remove the "Quick Edit" option from the list , this will also disable this option inside the list views (which i do not want to do). and if i chose to hide the tool bar from the webpart settings, this will remove the "new item" link. so what i am trying to achieve is how i can hide the following markup only "or edit this list" from the webpart tool bar only ?

now i checked the markup for this toolbar and i find the following:-

enter image description here

so i tried writing this javaScript:-

<script type="text/javascript">
 var k = document.getElementById('idHomePageNewItem');
 document.getElementsByClassName('ms-list-addnew').innerHTML = k.outerHTML;

But it did not have any effect. also when i checked the markup for the home page i did not find an element with id = idHomePageNewItem although on the Firefox F12 tool i capture this id !!

2 Answers 2


Try to use below jquery. It should work.

var objNewItem = $("#idHomePageNewItem")
  • Now this worked well in my case,, although i am afraid that the id = idHomePageNewItem might change in the future if we upgrade sharepoint or install cumulative updates... what do u think ?
    – John John
    Jun 30, 2017 at 14:01
  • 1
    Yes you are right. In this case ID can get change. May be I will let you know if I found some other work around. Jun 30, 2017 at 16:36
  • 1
    no i checked another farm which is 2016 on-premises (while my question/markup is based on 2013 on-premises) and i find that the New Item link inside the web part will have the same id idHomePageNewItem this gives me an indication that this id might change but not very frequent ?? what do u think ? as in 2013 and 2016 the New Item link have the same id..
    – John John
    Jun 30, 2017 at 17:30
  • 1
    I have checked this code in SharePoint Office 365 and this works perfectly. Here also ID is same. Yes it seems like there are very less chances to change this. Jun 30, 2017 at 19:28

Please try this, it might help you.

  1. Click on Gear icon > Edit page from top right corner of your ribbon
  2. Edit the web part's properties
  3. For Toolbar Type, select Top Toolbar
  4. Click on OK
  5. Click on Stop Editing button from ribbon to finish

Please refer below screenshot enter image description here

  • i am unable to reproduce the steps at my end ,, i am using sharepoint on-premises 2013.. now for the tool bar type i do not have "Top Toolbar" as an option..
    – John John
    Jun 30, 2017 at 14:59
  • Seems to be Sharepoint Online
    – golimar
    Mar 30, 2020 at 15:11

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.