How to include images in js,
My code :
if (firstStore.address && firstStore.state && firstStore.zip && firstStore.store_hours_weekdays && firstStore.store_hours_weekend_days && firstStore.phone ) { homeAddress = '<div class="homepage-store">' + firstStore.address + ',' + firstStore.state + ' ,' + firstStore.zip + '<br><br> ' <<add image here>> + firstStore.store_hours_weekdays +' <br> ' +firstStore.store_hours_weekend_days+ ' <br><br> ' <<add image here >> + firstStore.phone + '</div>'; }
There is multiple ways to insert the image in the js code, one of the pretty simple example code is here :
// Url of the Image var url = 'www.imageurl.com'; // HTML Image tag var imageTag = '<img src="' + url + '" alt="image" />'; if (firstStore.address && firstStore.state && firstStore.zip && firstStore.store_hours_weekdays && firstStore.store_hours_weekend_days && firstStore.phone ) { homeAddress = '<div class="homepage-store">' + firstStore.address + ',' + firstStore.state + ' ,' + firstStore.zip + '<br><br> ' + imageTag + firstStore.store_hours_weekdays +' <br> ' +firstStore.store_hours_weekend_days+ ' <br><br> ' + imageTag + firstStore.phone + '</div>'; }
Problem Solved !!
Click on 'Kudos' & Accept as Solution to encourage to write more answers !