Jump to content

Hiding elements by ID...


gray8110

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.