I'm learning how to use Vue and one of the methods in my practice code isn't working, any idea why?
When clicking 'Add name' an alert should pop up, but it doesn't.
new Vue({
el: '#array',
data: {
names: ['Jo', 'Joana', 'Joanna', 'Joan']
},
methods: {
addName: function() {
alert('Adding name');
}
}
});
<script src="https://unpkg.com/vue"></script>
<div id="array">
<ul>
<li v-for="name in names" v-text="name"> {{ names }} </li>
</ul>
</div>
<input type="text">
<button v-on:click="addName">Add name</button>