I wish to hide the edit items ribbon in one of the webpart pages where i am displaying a list view webpart.
I found the solution in this question, I am able to hide the ribbons.
The problem is , i am getting some java-script errors in my console when i use the code
The error details are below
MyPage.aspx:751 Uncaught TypeError: Cannot read property 'style' of null at hideEdit (MyPage.aspx:751) at eval (eval at ProcessOnLoadFunctionNames (init.js:1), <anonymous>:1:34) at ProcessOnLoadFunctionNames (init.js:1) at ProcessDefaultOnLoad (init.js:1) at NotifyEventAndExecuteWaitingJobs (init.js:1) at NotifyScriptLoadedAndExecuteWaitingJobs (init.js:1) at $_global_core (core.js:1) at core.js:1
I tried to manually locate the element in the console using
both are returning
undefined. I can't figure out this error and how is the above code working?
- Even if i change the id to something else i was able to hide the ribbons. why is it working?
- If the above queries are returning null it means the code is incorrect right?
Where to get the proper ids of these ribbons?
Did MS changed the ids in SharePoint-Online?
The above code achieves the desired functionality but i can't comprehend how. because the element is not present in any of my source code or in console.
So, please explain why it works even though element is absent and way to avoid the error.
I tried escaping the
\. but still the element is not present