I would like to set a data-src attribute on an img I am creating with JS.
Why does this not work?
const image = document.createElement('img');
image.className = 'restaurant-img';
image.src = '/img/1.jpg';
image.data-src = DBHelper.imageUrlForRestaurant(restaurant);
li.append(image);
IDE says: Must be lvalue
So I cannot assign it.
How else can I set the data-src on an img then from pure JavaScript (no jQuery);