Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Created November 19, 2019 21:53
Vue alter attribute(s) of elements in component

Using querySelectorAll

const inits = this.$el.querySelectorAll('[ga-init]');
inits.forEach(elem => {
  elem.removeAttribute('ga-init');
  elem.removeAttribute('data-ga');
});

Using $children

const children = this.$children;
children.forEach(elem => {
  elem.$el.removeAttribute('ga-init');
  elem.$el.removeAttribute('data-ga');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment