For a general answer to your question, I recommend starting here:

http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F

In order to specify code to run after the ajax is complete, you can provide
a callback as the final parameter to .load(). This will be executed when the
load is done (and the elements are in the dom). Something like:

$(function() {

var ids = '#SampleCustDue, #SampleCustReq, #SampleVendorReq,
#SampleVendorActual, #SampleVendorRec, #SampleCustShip, #SampleCustApprove,
#SampleVendorApprove';

$(".actions a").click(function () {
  $("#ajax_div").load($(this).attr("href"), function() {
    $(ids, this).datepicker();
  });
  return false;
})

});

- Richard

On Wed, Jun 25, 2008 at 1:22 PM, Eric <[EMAIL PROTECTED]> wrote:

>
> I  am sure this has been answered before, but I could not find it.
>
> I click on a link which loads a second page into a div using the load
> function
>
> $(document).ready(
>                        function()
>                        {
>                                $(".actions a").bind ("click",
>
>  function () {
>
>    $("#ajax_div").load($(this).attr("href"));
>
>    return false;
>                                                                        }
>                                )
>
>                                $('#SampleCustDue, #SampleCustReq,
> #SampleVendorReq,
> #SampleVendorActual, #SampleVendorRec, #SampleCustShip,
> #SampleCustApprove, #SampleVendorApprove').datepicker();
>                        });
>
> The page that is being loaded has several text fields that I am using
> the date picker plugin for (#SampleCustDue etc...)
>
> The problem is that the selectors are not finding these fields after
> the page has been loaded in the #ajax_div.
>
> My guess is that the page needs to be re-indexed, but I cannot find a
> function to do that.
>
> My other attempt was to create a new $(document).ready() function in
> the page that was being loaded via ajax, but that never seemed to get
> called.
>
> Any ideas?
>
> Thanks in advance!
>

Reply via email to