xxxxxxxxxx
1
<div class="chips-test chips-initial"></div>
1
1
xxxxxxxxxx
1
// Define the chip dom element
2
const chipsInitialNew = document.querySelector('.chips-test')
3
console.log("Chip element:")
4
console.log(chipsInitialNew)
5
6
// Instantiate the chip
7
const newChipsNew = new mdb.ChipsInput(chipsInitialNew, {
8
initialValues: [
9
{ tag: 'MDBReact' },
10
{ tag: 'MDBAngular' },
11
{ tag: 'MDBVue' },
12
{ tag: 'MDB5' },
13
{ tag: 'MDB' }
14
]
15
})
16
console.log('Chips instance')
17
console.log(newChipsNew)
18
19
// Try to find the chip instance we just created on the dom element
20
const foundChipInstance = mdb.ChipsInput.getInstance(chipsInitialNew)
21
console.log("Looking for chips instance")
22
console.log(foundChipInstance)
23
if (foundChipInstance == null) {console.log("Could not find the chip instance")}
Console errors: 0