Create a gist now

Instantly share code, notes, and snippets.

function materializeSelects() {
var label, parentEl;
document.querySelectorAll('select').forEach(function(control) {
parentEl = control.parentElement;
control.classList.add('mdl-selectfield__select');
if (parentEl.tagName !== 'DIV') {
return;
}
parentEl.classList.add('mdl-selectfield', 'mdl-js-selectfield');
label = parentEl.querySelector('label');
if (label) {
label.setAttribute('for', control.id || control.name)
label.classList.add('mdl-selectfield__label');
}
});
}
function materializeControls() {
materializeTextInputs();
materializeSelects();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment