Add Custom context menu by Javascript in SharePoint

If you want to add a custom menu item in Document Library’s item context menu just by Javascript without going into the details of ¬†adding any new feature or writing your own assembly then here is a quick trick:

  1. Add a new Content Editor Web Part on your target page
  2. Open the tool pane of the web part
  3. Click  university essay on art & architecture thesis topics for it report writing formats used book search entstehung viagra see url expiration date viagra https://mdp.berkeley.edu/wp-content/uploads/?online=cell-phone-emergency-essay follow https://ncappa.org/term/effects-of-playing-computer-games-thesis/4/ cymbalta for pain reviews brainstorm examples essay for oral presentation ap literature essay question 37 follow writing an essay compare and contrast homework help aim clomid and hcg shot with iui dostinex side effects click here https://amaanahservices.org/support/best-scholarship-essay-writer-service-for-mba/58/ a good cause and effect topic for essay scholarship aquinas cosmological argument essay sample define alternative hypothesis in statistics go to link advantage of smoking essay follow url cialis sales numbers go to link 2001 a metaphorical odyssey essay srce filmbay iv 08 html conflict management research paper jual levitra asli Source Editor and add following Javascript code in it
    <script language="javascript">
    function Custom_AddDocLibMenuItems(m, ctx)
    {
      var strDisplayText = "Say Hello World!";
      var strAction = "alert('Hello World')";
      var strImagePath = "";
    
      // Add our new menu item
      CAMOpt(m, strDisplayText, strAction, strImagePath);
    
      // add a separator to the menu
      CAMSep(m);
    
      // false means that the standard menu items should also be rendered
      return false;
    }
    </script>
    
  4. Click Save
  5. Click OK in toolpane to close it
  6. Now open the context menu of an item of the document library and you will see your new menu item in it similar to following

javascript-custom-menu

Please note that this menu item will only be visible on your target not on every page of your document libraries.

Share

2 thoughts on “Add Custom context menu by Javascript in SharePoint”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap