Does vue.js have a shorthand for document.getElementById('#id') like JQuery's $('#id')?
document.getElementById('#id')
$('#id')
If so, where is the reference for this in the docs so I can locate other information?
Theres no shorthand way in vue 2.
Jeff's method seems already deprecated in vue 2.
Heres another way u can achieve your goal.
var app = new Vue({ el:'#app', methods: { showMyDiv() { console.log(this.$refs.myDiv); } } });
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> <div id='app'> <div id="myDiv" ref="myDiv"></div> <button v-on:click="showMyDiv" >Show My Div</button> </div>
1.4m articles
1.4m replys
5 comments
57.0k users