2

Is there any chance of setting up an end or expiry date to content editor web part, so that it automatically go off when it passes the set date?

I am using SharePoint 2007.

1

Create an Content Editor WebPart and add this in the source code:

<div id="demo"> Add your content inside this div</div> 
<script>
  jQuery(document).ready(function($) 
  {
      var expiredDate  = new Date("2014-12-20"); // set here the expiration date

      if (expiredDate <= new Date())
      {
           document.getElementById('demo').style.display = 'none';
      }
  });
  </script>
  • 1
    This won't hide the web part, only the content inside the web part. This means that if the title or border are turned on it will still show up. Also, it will still take up space on the page. You want to use the JQuery to hide the entire web part. You can get the id of the web part using the developer console (F12) and use that id instead of the id of the content div. – Erin L Dec 24 '15 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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