How do I reset all the chips in an MDCChipset

Viewed 199

I'm currently using MDCChipSet and within it a bunch of filter chips, all of this inside a form. I want to be able to reset the form and reset all of the chips on the form.

Here's a codepen of the issue.

You can see when you click the chip, then hit reset, the chip stops working.

I also noticed that select chips don't work at all if you attach MDCChip to them like below:

[].slice.call(document.querySelectorAll('.mdc-chip')).forEach(
function(ele) {
    mdc.chips.MDCChip.attachTo(ele);
});

**EDIT

For some reason the MDCChipSet is being removed from the elements. So after the reset if you reattach it, it works, but I have no idea why. so any help would be greatly appreciated:

[].slice.call(document.querySelectorAll('.mdc-chip-set')).forEach(
  function(ele) {
      mdc.chips.MDCChipSet.attachTo(ele);
  });
0 Answers
Related