1👍
✅
To comply with the standards of Vuejs you need to include the selectCustomer function in the methods of vuejs and call the method accordingly where you need to change it from. Instead of having selectCustomer as a separate js function. Also have the contents on b.html directly inside the <div id="bHtml"></div>
and change the value through the selectCustomer method. Like so
template: `<div class="form-group col-md-4" v-for="ec in eb.ecustomerList"> // rest of the html </div> <div id="bHtml"> <div> selected name {{item.name}}</div> <div> selected id {{item.id}}</div> <div> selected text {{item.otherName}}</div> </div>`, data: function(){ return{ item:{name:'', id:'', otherName:''} } }, methods:{ selectCustomer: function(id, item, vModel) { $("#"+id).val(item.name); $("#"+id+"Id").val(item.id); $("#"+id+"Text").val(item.otherName); //update the vmodel as required vModel = newValue; } }
You need to understand that Vuejs changes your application according to the reactive data change method. Instead of using jQuery to manipulate the html DOM.
Source:stackexchange.com