mebibou/mdl-selectfield

Uncaught ReferenceError: componentHandler is not defined

ronnievsmith opened this issue · 5 comments

I added the following to my page after loading the js and css files to my server, copied your example on to my page and the select behavior fails. Console says Uncaught ReferenceError: componentHandler is not defined.

<link rel="stylesheet" type="text/css" href="css/mdl-selectfield.min.css" >
<script src="js/mdl-selectfield.min.js"></script>

did you include material-design-lite before? this library is an "extension" of the mdl one, so if you don't include it, it won't work (which is why it is set as a dependency)

I have the same problem script defer src="https://code.getmdl.io/1.1.3/material.min.js"></script script src="js/moment.min.js"></script script src="js/mdDateTimePicker.js"></script script src="js/main.js"></script
the javascript is in main.js BTW i removed some > and < because otherwise it would disapear

Please remove the defer attribute on the material library, i.e:

<script src="https://code.getmdl.io/1.1.3/material.min.js"></script>
<script src="js/moment.min.js"></script>
<script src="js/mdDateTimePicker.js"></script>
<script src="js/main.js"></script>

Alternatively, if you want to keep the defer attribute, make sure to also add it to the libraries that depend on material

Removing the defer key from material design lite js link works