1
in certain part of my code I need to make a request using javascript with several equal ids.
The problem is that it is overwriting the ids with the last selected.
My Html:
<button class="btn btn-default border-none" v-on:click="massDelete()" style="width: 100%">
Apagar
</button>
<td class="text-center">
<input type="checkbox" v-on:click="pushId(property.id)">
</td>
My java script;
pushId(propertyid)
{
this.ids.push({property_id: propertyid});
},
massDelete()
{
var obj = {};
for(let item of this.ids)
{
obj = {property_id: item.property_id};
}
console.log(obj);
}
}
I need the answer to be
array({
"property_id": 3
}
{
"property_id": 4
}
{
"property_id": 5
})
PS: I cannot use a form because of layout layout
I didn’t understand your doubt, could you explain better which part of the code you have doubt? And what exactly do you want to do?
– Thiago Yoithi
Ids are unique Each element can have only one ID; Each page can have only one element with that ID. You should reformulate your html code so as not to use id.
– Luís Almeida
@Thiagoyoithi changed the question, see if you can understand now
– Ivan Moreira