Marina Mosti is a full-stack web developer with over 14 years of experience in the field. She enjoys mentoring other women on JavaScript and her favorite framework, Vue.
Hi Aniketnaik, well... In Vue as you probably know by now, we declare the listeners directly on the template using @click or @event and pass in the name of a method. It is possible to attach listeners using vanilla javascript by doing element.addEventListener and passing a function, but it depends on what you're trying to accomplish. Good luck
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Is it possible in Vue.js to put event handling code just in one place(in js file), like we do in jquery.
$("#btnSubmit").click(function(e){
alert("example");
});
Hi Aniketnaik, well... In Vue as you probably know by now, we declare the listeners directly on the template using @click or @event and pass in the name of a method. It is possible to attach listeners using vanilla javascript by doing element.addEventListener and passing a function, but it depends on what you're trying to accomplish. Good luck