Reputation: 67
Hi guys I'm new at Vue and I want to know how to manipulate the DOM without using stuffs like document.querySelector / getElementbyId etc
For example, if I have an input like this
<input id="myInputId" class="myInputClass" type="text"/>
how can I get the id, the class and the type by using Vue tools easily ?
Upvotes: 3
Views: 6951
Reputation: 2295
You should use ref
for that. I did set up a simple example here, using Vue3 + composition API. You now can do whatever you want with it.
Vue docs - https://vuejs.org/guide/essentials/template-refs.html
Upvotes: 3