Quick reminder : Check if an element exists in JQuery (and hide some button in SharePoint UI !)


For some reasons, I needed to hide the approval button in my SharePoint user interface so the easiest way was to do

if($('#qaPublish').hide();

Only issue is that when there is no approval button (no approval workflow activated on some web for example), the "Approve and Publish" (qaApprovePublish) becomes the "Publish" button (qaPublish)

So a quick way is to do this when the document is ready :

if ($('#qaPublish').length  && $('#qaApprovePublish').length)
{
    // both are found, hide the approve button
   $('#qaPublish').hide();
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s