I am findiing Divs dynamically in my LWC component using data-id and that works. But when i am trying to set background image, it says.cannot read of property style of undefined. here is my code:
wiredResult({
error,
data
}) {
if (data) {
this.result=data;
for(var i=0;i<this.result.length;i++)
{
console.log('RESULTID'+this.result[i].Id);
this.target = this.template.querySelectorAll("[data-id="+this.result[i].Id+"]");
console.log('target'+this.target);
this.target.getelement().style.backgroundImage= this.result[i].Offer_Image__c;
}
any hrlp wil be appreciated.