views:

56

answers:

1

I have been working on this for days but I don't get it so I decided to ask here. I really have a hard time tracing where is the problem is in my code.. here my code:

  $(".editME").click(function(){

      var element = $(this);
      var show = element.attr("id");

      $.get('index.php',{option:'myReports', task: 'edit', id: show},function(data)
      {
          $('body').html(data);
          $("#editFile").show(1000);
      });
      return true;
  });

When I click the edit button it while showing the whole page and inside of it I have the plugin datepicker. The problem is it doesn't show the calendar:

  $(function() {
      $("#datepicker").datepicker({
          changeMonth: true,
          changeYear: true
      });
  });

When I change the URL to index.php?option=myReports&task=edit.. the calendar appears.

My question: how can I load the calendar while I execute the editME?. Even if I return true it doesn't execute.

A: 

Well, you might be able to use

$("#datepicker").live("click", function(){
  $(this).datepicker({ changeMonth: true, changeYear: true });
});

Read up on the live() method. It makes jQuery recognize dynamically generated objects.

D_N
thanks you fast replyedi dont get the date shown but it takes time to execute.. about 10s to execute.
mapet
And by execute you mean do nothing? The boxes don't show? If so, I'm afraid I'm out of ideas. You might try adding some HTML to your question and seeing where/if you can clarify.
D_N
the box show but intakes time to appear the calendar box. jquery have lots of attitudes :(.. i test the datepicker in google crome it runs fast well in firefox so slow.. edit 1 class="editME"edit 2 class="editME"edit 3 class="editME"onclick edit 1.. edit 2 and edit 3 disable.. even if i put $(".showlogs").live("click",function(){it doesn't work at all.. :(
mapet
You might try putting that code in your question as an update. I'm not sure I can make sense of it.
D_N