I'm trying to create a click event in Vue in a static HTML file as test but it doesn't work as expected. See full code below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--[if IE]><![endif]-->
<!--Empty IE conditional comment to improve site performance-->
<html lang="en">
<head>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<script type="text/babel">
var titleFilter = new Vue({
el: '#filter',
methods: {
clickEvent: function(){
console.log('Vue is working.');
}
}
});
</script>
<a id="filter" v-on:click="clickEvent" href="#">CLICK ME</a>
</body>
</html>
So as a checklist:
- I have my function in a method object
- Function names are correct
- I'm including the library
- In my script tag, I'm specifing babel as type
It's not working, what's wrong?
#filterexists.filterand then remove the filter ID from anchor tag