Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDL not applied to elements loaded through AJAX #1393

Closed
facekapow opened this issue Aug 14, 2015 · 5 comments
Closed

MDL not applied to elements loaded through AJAX #1393

facekapow opened this issue Aug 14, 2015 · 5 comments

Comments

@facekapow
Copy link

When using $('#element').load('some-page.html'), MDL events are not applied to any MDL elements on the requested page (style works fine, though). A simple fix would be http://stackoverflow.com/a/23247146, simply attach the event to the body and test for the class, right?

@Garbee
Copy link
Collaborator

Garbee commented Aug 14, 2015

This is out of the scope of what MDL supplies. Please use StackOverflow for support in building your web sites.

@Garbee Garbee closed this as completed Aug 14, 2015
@facekapow
Copy link
Author

Ok, but thanks anyway!

@tleunen
Copy link
Contributor

tleunen commented Aug 14, 2015

Not sure what you use to load your page, but you should be able to set a callback and manually upgrade the elements in the new page.

@facekapow
Copy link
Author

I finally had the time to look through the source and I found a solution: call componentHandler.upgradeAllRegistered() in the AJAX callback, simple as that!

@maaadmin
Copy link

maaadmin commented Jun 5, 2018

Thank you for finding this. 🥇 for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants