1

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.

1
  • 1
    Load this "datepicker" when you complete your ajax request. Because page only load this for once, you need to check every time. Commented Oct 23, 2013 at 11:05

3 Answers 3

1

Try to initialise the datepicker in the callback function:

$( "selector" ).load( "yourpage.html", function() {
    //init datepicker
});
Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

but i got "Uncaught TypeError: Object [object Object] has no method 'datepicker'" error. need to add the jquery-ui.js and jquery-ui.css again.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.