google / material-design-lite

Material Design Components in HTML/CSS/JS
https://getmdl.io
Apache License 2.0
32.29k stars 5.03k forks source link

MDL component is not able load when requesting with ajax. #5350

Closed klarnol closed 3 years ago

klarnol commented 3 years ago

I am working on spring boot project with jsp and meterial design lite.

The jquery code looks like below. $.get("${pageContext.request.contextPath}/info/getform", function(data){ $("#mainContent").html(data); }); }); Material design lite code looks like below

The behavior of display when performing request with form action attribute normal. But while request performing with jquery ajax request to backend generating same code. But text field is displaying abnormal. It is very major issue while working with backend applications. behaviour of mdl component

klarnol commented 3 years ago

adding "window.componentHandler.upgradeDom();" like as shown below solved my issue

$.get("${pageContext.request.contextPath}/info/getform", function(data){ $("#mainContent").html(data); window.componentHandler.upgradeDom(); }); });