开发者

Datepicker doesn't execute when submitted

I have been working on this for days but I don't get it so I decided to ask here. I really h开发者_运维知识库ave 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜