In SharePoint 2013, I'm trying to figure out how to hide or disable the Cancel button in the ribbon for the default form (NewForm) for a document library. Looking at the form source, I think this is the HTML element I'm after (ID of Ribbon.DocLibListForm.Edit.Commit.Cancel-Large):
I've tried various forms of the jQuery code:
But that doesn't seem to have any effect. I believe I'm able to actually locate the object in the DOM because the code snippet:
var myObj = $('#Ribbon.DocLibListForm.Edit.Commit.Cancel-Large'); alert("myObj="+myObj);
... does populate the variable with an object. Also, I tried the .disable() method which interestingly resulted in the error "Object doesn't support property or method 'disable'", so that also leads me to believe I'm able to find the element ... just not hide it.