I have :
<span class="badge" id="total">10</span>
If I using jquery :
$('#total').text()
How to get it if using vue.js 2?
I have :
<span class="badge" id="total">10</span>
If I using jquery :
$('#total').text()
How to get it if using vue.js 2?
Why does your HTML look like that?
You should never need to do what you're asking in a Vue application. With a MVVM application you'd have something like:
new Vue({
data: {
total: 10,
},
})
Then a template like:
<span class="badge" id="total">{{ total }}</span>
That way, in your VM, when you set this.total = 12 the DOM will update automatically and this.total will always return your total.