0
votes

initialising materiliaze-css with M.AutoInit() I receive: "Cannot read property 'classList' of undefined".

Same result if I select and initialise the single element (that exists) and component:

const tabBars = document.querySelectorAll('.tabs')
tabBars.forEach((element) => {      
    M.Tabs.init(element)
})

the same for

const tabBar = document.querySelector('.tabs')
M.Tabs.init(tabBar)

Any idea? Thanks.

1

1 Answers

0
votes

Solved. FYI: using the second script requires that the class ".tabs" is related to an "UL" element and the class ".tab" to its children. I was trying to use them with different tags elements... my bad.