Another question about the fantastic Christophe Humbert Easy Tabs library: Can the library be included in a page layout for a publishing site rather than in a content editor web part? This way it's automagically included in all pages based on the page layout, rather than a CEWP that has to be dropped into each page from the gallery.

I spent yesterday trying to achieve this with no luck; I dropped a reference to the JS file at the end of the closing tag in the page layout. This is after all the sections that will contain web parts. The tabs showed but they didn't work correctly; only the Expand All and Print Preview worked. The rest had no content. I tried moving the JS reference to other parts of the page layout, but none worked.

Your help is appreciated. Thanks.

1 Answer 1


The Easy Tabs script needs to know which Web Part zone the tabed interface should be applied to.

When you drop it in a CEWP, the code assumes that the tabs will be created in the current zone. It also assumes that it runs from within a Web Part (CEWP or other). Its first step is to crawl up the hierarchy to find the Web Part zone.

In order to make it work in a page layout, you would need to modify the code to explicitly point to the correct Web Part zone.

  • Thanks, Christophe. It took me a day just to discover that it only worked as a CEWP; it uses its current context. I only need the web parts in a specific DIV to be shown in a tabbed UI. Your code works its way up the tree through the initial DO-WHILE loop using the variables declared right before it. It stops when it hits the outer container MSO_ContentTable. Beyond that, it's a mystery to me.
    – Alex C
    Commented Sep 8, 2011 at 14:58
  • 1
    Right. Instead of the do-while loop, you would need to directly point to the container.
    – Christophe
    Commented Sep 8, 2011 at 15:55
  • Got it!! Commented out the do-while loop and added this: p = document.getElementById('ctl00_PlaceHolderMain_ctl01__ControlWrapper_RichHtmlField'); The web parts I need to add to tabs are all inside the RichHtmlField, generated from the custom page layout. Took some trial-and-error to understand how your clever code worked.
    – Alex C
    Commented Sep 11, 2011 at 6:22
  • will this EasyTabs web part work with SharePoint 2010 ?
    – samolpp2
    Commented Sep 30, 2015 at 14:38
  • @SaMolPP yes: usermanagedsolutions.com/SharePoint-User-Toolkit/default.aspx
    – Christophe
    Commented Nov 10, 2015 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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