Deprecated: Assigning the return value of new by reference is deprecated in /fs5e/blendedtechnologies/public/wp-content/plugins/pmetrics.php on line 1192
Blended Technologies » Blog Archive » How to Make an HTML Element on Your Website Disappear after 10 Days

How to Make an HTML Element on Your Website Disappear after 10 Days

After October 15th, 2007 this message will disappear forever.

The text above is an example of auto-expiring HTML. (Don’t see it? If it’s after October 15, 2007, then it’s working ;-) Perhaps try viewing the source of this page to see it.)

Do you have any of these problems? If so then auto-expiring HTML may help you:

  1. You put a “new” images around new content on your website, but then forget to ever remove them thus embarrassing yourself and your community.
  2. You put a deadline for your project on a website, but if you miss the deadline, wouldn’t it be nice if the deadline conveniently disapeared from the page automatically? ;-)
  3. Your brilliant blog post made it to the front page of Reddit. You want to put a message welcoming them, but since they’ll only be around for a day, you want the message to disappear automatically by the next day.

(All these examples assume you’re lazy, and care more about convenience than bandwidth.)

Can you think of more uses for auto-expiring HTML? Please leave a comment.

How to Make Auto-Expiring HTML


I’ve made this handy utility to automatically create auto-expiring HTML for you. You enter the content you want to expire, set the number of days to expiry, and paste the output into your webpage. Check it out.

How it Works

The utility wraps a div tag around whatever HTML you enter, and puts some javascript under it to hide that div if the current date is greater than your set expiration. There’s more information about its workings in the utility’s writeup. |  Digg |  FURL |  Yahoo! My Web 2.0 |  Reddit

4 Responses to “How to Make an HTML Element on Your Website Disappear after 10 Days”

  1. davidg Says:

    ok … what if they have javascript disabled?

    Wouldn’t it be more proper to write a Wordpress plugin that leverages the database and its builtin time functions to deem whether or not to show the “new” item to begin with? There’s little point to sending old-or-unwanted “new” information to the end-user and then _hoping_ to hide it with js usage. Let the db do the work for you.

  2. Greg - CEO/Founder Says:

    That’s an idea. I was trying to make it more general purpose than just WordPress though.

  3. Mark Fulton Says:

    Great tip and tool, thank you! I have submitted this to Stumble and Digg. Cheers.

  4. Greg - CEO/Founder Says:

    Thanks Mark. Hope stumblers and Diggers like it.