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 8045349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:31:15+00:00 2026-06-05T05:31:15+00:00

<ul id=months> <?php foreach ($months as $key => $value) { ?> <?php if ($key

  • 0
<ul id="months">
                <?php foreach ($months as $key => $value) { ?>
                    <?php if ($key != 0 && array_key_exists($key, $monthArray) && date("m") > $key) { ?>
                        <li id="<?= $key ?>"><a href="#" rel="nofollow"><?= $value ?></a></li>
                        <?php
                    }
                }
                ?>

below is the jquery code

        $("#year").change(function(){
//        alert($(this).val());
        $.ajax({
            type: 'get',
            url: 'ay/templates/frontend/_previous_months.tpl.php',
            data: 'year=' + $(this).val(),
            success: function(data) {
                $("#months").html(data);`
            }
        });
    });

Problem : when i first time request partial i get proper result, but after when i get months partial i can t access jquery from it,

below is the jquery function which i need to access after when i get my parial(before making above ajax call, i can access below jquery function when i click on li item)

$("#months li").click(function(){
    alert("aaaaaaaaaaaaaaaaaaa");
    $.ajax({
        type: 'get',
        url: 'ay/templates/frontend/_previous_charities.tpl.php',
        data: 'month=' + $(this).attr("id") + '&year=' + $('#year').val(),
        success: function(data) {
            if(data == 'false'){
                $("#charity_result").html("No previous charity in selected Month");
            }else{
                $('#charity_result').fadeOut('slow');
                //                $('#ajax-result').fadeIn('slow');

                $('#charity_result').fadeIn('slow');
                $("#charity_result").html(data);

            }

        }
    });
});
  • 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-06-05T05:31:16+00:00Added an answer on June 5, 2026 at 5:31 am

    I think your click event is not added to your #months li.
    Try using the live method: http://api.jquery.com/live/

    Instead of:

    $("#months li").click(function() {

    use this:

    $("#months li").live('click', function() {

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript function generateGraph() { ... jQuery.get('chart.php?month='+month+'&year='+year); document.getElementById('graph').src = 'charts/'+month+'_'+year+'.png'; ... }
<?php while($show = $grabAlbums->fetch() ){ $date_headers_array[date('m', $show[date])][date('d', $show[date])][] = $show; } foreach ($date_headers_array as
PHP: How to sum the result of a foreach statement? Below is my working
A few months ago, I was working on a PHP project in Aptana Studio.
I need some advice before I start. My PHP Skills are only 3 months
in my php code I was asking the user to choose day, month and
Suppose I want to create a select box in PHP. $months = array ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
Currently I'm using a for statement in PHP to get all the months for
I'm using PHP's new(ish) Date classes for a calendar/scheduler I'm developing. I am trying
I need to add a zero to the date value that is posted as

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.