Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7568289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:53:16+00:00 2026-05-30T14:53:16+00:00

I have the following markup: <div class=calendar> <div class=heading> <a class=previous-month href=javascript:;></a> <h1 class=hmc>February&nbsp;2012</h1>

  • 0

I have the following markup:

<div class="calendar">
    <div class="heading">
        <a class="previous-month" href="javascript:;"></a>
        <h1 class="hmc">February&nbsp;2012</h1>
        <a class="next-month" href="javascript:;"></a>
    </div>

    <ul class="week hmc">
        <li>Su</li>
        <li>Mo</li>
        <li>Tu</li>
        <li>We</li>
        <li>Th</li>
        <li>Fr</li>
        <li>Sa</li>
    </ul>

    <ul class="january days hmc current">
        <li>&nbsp;</li>
        <li>&nbsp;</li>
        <li>&nbsp;</li>
        <li><a href="javascript:;">1</a></li>
        <li><a href="javascript:;">2</a></li>
        <li><a href="javascript:;">3</a></li>
        <li><a href="javascript:;">4</a></li>
        <li><a href="javascript:;">5</a></li>
        <li><a href="javascript:;">6</a></li>
        <li><a href="javascript:;">7</a></li>
        <li><a href="javascript:;">8</a></li>
        <li><a href="javascript:;">9</a></li>
        <li><a href="javascript:;">10</a></li>
        <li><a href="javascript:;">11</a></li>
        <li><a href="javascript:;">12</a></li>
        <li><a href="javascript:;">13</a></li>
        <li><a href="javascript:;">14</a></li>
        <li><a href="javascript:;">15</a></li>
        <li><a href="javascript:;">16</a></li>
        <li><a href="javascript:;">17</a></li>
        <li><a href="javascript:;">18</a></li>
        <li><a href="javascript:;">19</a></li>
        <li><a href="javascript:;">20</a></li>
        <li><a href="javascript:;">21</a></li>
        <li><a href="javascript:;">22</a></li>
        <li><a href="javascript:;">23</a></li>
        <li><a href="javascript:;">24</a></li>
        <li><a href="javascript:;">25</a></li>
        <li><a href="javascript:;">26</a></li>
        <li><a href="javascript:;">27</a></li>
        <li><a class="alt current" href="javascript:;">28</a></li>
        <li><a href="javascript:;">29</a></li>
        <li>&nbsp;</li>
        <li>&nbsp;</li>
        <li>&nbsp;</li>
    </ul>
</div>

Here I generate a calendar. I want to highlight the current day I am clicking on. I have tried:

$('body').on('click', '.january > li > a', function() {             
    $(this).closest('.january').children('li').each(function() {
        var anchor = $(this).children('a');
        anchor.addClass('alt current');
    )}
)}

But it doesn’t work. Also I want to select the value of the item I am clicking on, e.g. the day

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:53:19+00:00Added an answer on May 30, 2026 at 2:53 pm

    The traversal you are doing with each(), closest() and children() isn’t necessary, try this:

    $('body').on('click', '.january > li > a', function() {
        $(".january > li > a").removeClass("alt current");            
        $(this).addClass('alt current');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following markup: <div class=promo> <p class=preview><a href=#><img src=preview.png></a></p> <p class=caption><a href=/>Project
I have the following markup <div id=FirstDiv> <div class=MyClass> <span> <a href=#>link 1</a> <a
I have the following markup: <div id=routes> <ul id=routesList> <li class=routes>Route 1</li> <li class=routes>Route
I have the following (trimmed) markup: <asp:Repeater ID=CostCategoryRepeater runat=server> <ItemTemplate> <div class=costCategory> <asp:Repeater ID=CostRepeater
I have the following markup: <!-- first marker --> <div class=marker></div> <div class=tooltip> <p>My
I have the following markup for my input fields: <div class=required> <label for=Name>Name <em>*</em></label>
I have the following HTML markup: <body> <div class=wrapper> <div class=head> <p class=title>title</p> <a
If I have the following markup <div id=previewNote class=note yellow style=left:25;top:25px;z-index:1;> <div class=body></div> <div
I have the following markup: <div class="header">Text</div> <div class="hiddenArea">sdsada</div> <div class="header">Text2</div> <div class="hiddenArea">sdsada</div> and
I have the following markup: <div class=user-photo> <img src= /> </div> I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.