Material-design-lite: MDL not applied to elements loaded through AJAX

Created on 14 Aug 2015  路  5Comments  路  Source: google/material-design-lite

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?

Most helpful comment

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!

All 5 comments

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

Ok, but thanks anyway!

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.

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!

Thank you for finding this. 馃 for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

an0nh4x0r picture an0nh4x0r  路  3Comments

raffomania picture raffomania  路  4Comments

adiramardiani picture adiramardiani  路  4Comments

nisrulz picture nisrulz  路  5Comments

lgg picture lgg  路  3Comments