Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-17-2009, 11:26 AM   PM User | #1
nikos101
Senior Coder

 
nikos101's Avatar
 
Join Date: Dec 2006
Location: London
Posts: 1,004
Thanks: 58
Thanked 10 Times in 10 Posts
nikos101 is an unknown quantity at this point
Smile jquery help, hide and get day month name

Hi there

How can I use Jquery to change the span text to the current month name and hide the tr if its after the 15th of the month?

Code:
   <tr class = "hideIfDayOfMonthAfter15">
                      <td class="flag" ><span class="month"> December</span> </td>
                          </tr>
__________________

nikos101 is offline   Reply With Quote
Old 11-17-2009, 02:35 PM   PM User | #2
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
If you're looking for a pure jquery/javascript solution, the date would always depend upon the client system. A much better way to handle this would be to use your server-side language to determine which rows to display. Then your always sure the date is what you expect.

For javascript, the current date (of the client system) relies on new Date(). The first answer to this post shows how to fetch the current date by parts. That would take care of the span month. To hide the tr, you could test the current day value and hide/show based on that.
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:23 PM.


Advertisement
Log in to turn off these ads.