Wednesday, February 2, 2011

'style.display' is null or not an object error

As you create pages you may see the following error:



If you do, it is probably because you have copied and pasted from one content editor web part into another. If you see this error you will need to check your content for any WebPartID that is being referenced. The copy paste will copy this into the new content, breaking the content, if you remove the DIV tags that contain that reference, it will fix the page.

If you want to avoid this you should copy the text out of the original web part, paste it into a word document and then copy the word document content and paste it into the new web part, this reformats and removes the WebPartID.

Thanks to egghead cafe for the discussion that is summarized in this solution.