How to show/hide div tag based on the user permission

I have used custom div for share icon.When admin login to the site the share icon will be shown.and other user login to the site the share icon will be hidden.how can I do this?

=================

=================

2 Answers
2

=================

The proper solution will depend on where you put the DIV tag (e.g. Masterpage (HTML vs. .NET), Page Content, Content Editor Web Part).

You should look into the SPSecurityTrimmedControl. Here are some links that will help you:

SPSecurityTrimmedControl class

How to: Add a Security Trim snippet in SharePoint 2013

You can use a SPServices to hide div with its ID if the current user belong to a specific group as the following