Materialize: How do I init a Select with options?

Created on 4 Sep 2018  路  2Comments  路  Source: Dogfalo/materialize

I want to load my options through code and not html, the document does a really bad job explaining how to do this. Actually it doesn't address it at all. Is it possible?

All 2 comments

I assume you're talking about the Dropdown.

document.addEventListener('DOMContentLoaded', function() {
    var elems = document.querySelectorAll('.dropdown-trigger');
    var instances = M.Dropdown.init(elems, options);
});

Documentation can be found here: https://materializecss.com/dropdown.html#initialization

I am talking about Select dropdown <options></options> grammatically

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PhillippOhlandt picture PhillippOhlandt  路  3Comments

cope picture cope  路  3Comments

onigetoc picture onigetoc  路  3Comments

alexknipfer picture alexknipfer  路  3Comments

locomain picture locomain  路  3Comments