I need help changing the classNames of elements with the "link" class. When I call a method via a click action, I can successfully get the length of the elements, but adding a class does not seem to work. Does anyone have any insights into this issue?
HTML
<div id="app">
<ul>
<li><a href="#" class="link" @click="myFunc">Link text 1</a></li>
<li><a href="#" class="link" @click="myFunc">Link text 2</a></li>
<li><a href="#" class="link" @click="myFunc">Link text 3</a></li>
</ul>
</div>
JS
var app = new Vue({
el: '#app',
methods: {
myFunc: function(event){
// works
var ElLength = document.getElementsByClassName('link').length;
console.log('ElLength = ' + ElLength);
// does not work
document.getElementsByClassName('link').className += " hullaballoo";
}
}
});