1

I'm looking to hide specific elements when editing a Multiple Lines of Text (Rich Text) Field. I currently have the below code working and hiding the Fonts drop down and the entire Insert tab. It was developed this was because it was intended for only one field on one NewForm.aspx. But my client now wants this applied to the entire site collection when using the RTE. Is there a better way to do this at the top level so these elements never show?

$( document ).ready(function() {
    //Ensure Guid doesn't change on these fields - Attach click event to Comments(Description) and Additional Details field
    var desc = $("div[id='Comments_9da97a8a-1da5-4a77-98d3-4bc10456e700_$TextField_inplacerte']");
    if(desc){
        $(desc).on('click', function(e) {
            HideRibbonElements()
        });
    }

});

function HideRibbonElements()
{
       setTimeout(function(){ 

            //Hide Fonts Drop down
            document.getElementById("Ribbon.EditingTools.CPEditTab.Font.Fonts-Medium").style.display = "none";
            //Hide the Insert Tab
            document.getElementById("Ribbon.EditingTools.CPInsert- title").style.display = "none";  

    }, 1000);
}
0

One Word: CSS

You can hide Elements with CSS .

To hide any Fonts in the Ribbon use this code:

Ribbon.EditingTools.CPEditTab.Font.Fonts-Medium

{ Display:none; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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