Innovative Thinker
Innovative Thinker

Reputation: 1795

Loading the page dynamically using jquery load

I am loading the five php page using jquery load method when clicking the tab dynamically. But some of the jquery functions(datepicker) are working only when the page is getting loaded(ie globel refresh). If i go to another tab and return back means which is not working.

Actually i have added the datepicker control in some of my php pages. The datepicker works only when the page is loaded initially. After that it doesnt work nor throw an issue. I thought the $('selector').load() is the cause for this issue.

Can anyone help.

Upvotes: 1

Views: 108

Answers (3)

Fahad Ajmal
Fahad Ajmal

Reputation: 1520

Yes that is because maybe you are not initializing it again. Every time you use (.load) you have to re-initialize the datepicker library. Hope that works for you.

Upvotes: 0

Jacques Snyman
Jacques Snyman

Reputation: 4290

I'm just taking a shot in the dark here as you've not given us much code to work with.

Add a callback to your load function to reinitialize the datepicker.

$('selector').load('yoururl', function()
{
    $('.datepicker').datepicker();
});

If that doesn't work, please add some code to your question.

Upvotes: 0

Jonathan
Jonathan

Reputation: 773

Try to initialise the datepicker in the callback function:

$( "selector" ).load( "yourpage.html", function() {
    //init datepicker
});

Upvotes: 1

Related Questions