0

I have that scenario. I load dynamically the Page A which contains some JS code. Inside that page, I can dynamically load another Page B (which can be also dynamically removed by using fadeOut effect and .remove() function)

The Page B contains a jQUery's UI datepicker plugin (and also some other plugins).

And here's the thing: if I load the Page B, the datepicker is initialized properly, but if I remove that Page B and re-load it, that datepicker is not being initialized. Why ?

I'm using the .datepicker("destroy") function and then .datepicker({...}) inside the Page B but without any effect.

3
  • Is there any js error? All browsers? Commented Nov 23, 2012 at 13:50
  • Because you're dynamically loading content the JS for that page has run and completed. Have a look at jQuery's on() method api.jquery.com/on Commented Nov 23, 2012 at 13:50
  • @Diego - I've checked it on Chrome and Firefox. I don't get any errors Commented Nov 23, 2012 at 13:53

1 Answer 1

1

try importing your B js in the A js like this:

$.getScript("yourOwnPath/theB.js", function() {
        });
Sign up to request clarification or add additional context in comments.

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.