2016-04-07 9 views
1

外部ファイルを使用してMDLスイッチをロードしようとしていますが、動作していません。ここでMaterial Design Liteスイッチがjquery loadで動作しない

は私のメインページのコードです:ここで

<!doctype html> 
<html lang="en"> 
<head> 
<link rel="stylesheet" href="material.min.css"> 
</head> 

<body> 
<a href="#" class="lo">Load</a> 
<div class="demo-switch"> 

<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="switch-2"> 
<input type="checkbox" id="switch-2" class="mdl-switch__input" /> 
<span class="mdl-switch__label">Bluetooth</span> 
</label> 

</div> 

<script src="js/material.min.js"></script> 
<script src="js/jquery.js"></script> 
<script> 
$(document).ready(function(){ 

    $.getScript("js/material.min.js").done(function(){ 

     $(document).on("click",".lo",function(){ 
     $('.demo-switch').load("new_test.php"); 
     }); 
    }); 



}); 

</script> 

</body> 
</html> 

はindex.phpはここ

<div class="demo-switch"> 

<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="switch-2"> 
<input type="checkbox" id="switch-2" class="mdl-switch__input" /> 
<span class="mdl-switch__label">Bluetooth</span> 
</label> 

</div> 

new_test.phpファイルである私は、ロードボタンを押した後、結果されています

Here are the result after i press load button

jsが正常に動作していない可能性がありますが、方法が見つかりませんこれを修正してください。 助けてください

答えて

1

dynamicHandler.upgradeAllRegistered()に電話する必要があります。

+0

ありがとう、それは働いた –

関連する問題