Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,008
    Thanks
    59
    Thanked 10 Times in 10 Posts

    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>


  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •