How To Read Data From A FOR Loop Inside DIV Elements
Considering the next code: HTML GENERATED:
Solution 1:
Since you're using Vue.js you don't need onclick
, you could replace it by @click
and pass your result
and $event
like parameters :
...
<a href="/details" class="btn btn-info" @click="getData(result,$event)">Details</a>
...
and inside your methods call that function as follow :
const vm = new Vue({
el: '#networdapp',
data: {
results:[]
},
methods:{
getData: function(result, event) {
// and do whatever you want with that result and event like
console.log(event.target.outerHTML);
// here your target is a anchor element (<a></a>) which you can access its attributes ..
}
}
...
}
also you can delete that function getData(){...}
Post a Comment for "How To Read Data From A FOR Loop Inside DIV Elements"