Jump to content

Recommended Posts

I have a press release document that is provided for me every month with a schedule of events for the month. I really don't touch the release, it just goes on the web after running a little script to add the appropriate HTML tags - it's currently a static HTML page with no intellgence at all. Currently, it displays a whole month of events but this isn't ideal because it forces users to scroll to the next event. I'd like to add some functionality that would hide the content that is prior to today's date. Here's an example of the HTML and how I'd like it to be afterwards:

 

before

<div id="092208">Content... don't want to show this because this is old</div>
<div id="092408">Want to show this because it is today or in the future</div>
<div id="092508">Want to show this because it is today or in the future</div>

 

after

<div id="092408">Want to show this because it is today or in the future</div>
<div id="092508">Want to show this because it is today or in the future</div>

 

I know my way around conditionals well enough to write a function that will determine if the ID is prior to today's date, but I don't know how to hide those divs. I can think of a few ways to do this with javascript, but a significant number of my users are at work PCs that have JS disabled by default.

 

Any ideas on how to do this - or if you have a more elegant way to approach it, feel free to speak up.

 

 

Link to comment
https://forums.phpfreaks.com/topic/125570-hiding-elements-by-id/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.