I'm trying to insert an additional select option to a list, but with specific data elements:
function myFunction() {
var x = document.getElementById("mySelectList");
var option = document.createElement('option', {
"data-img-src": "https://blah",
"data-img-alt": "https://blah"
});
option.text = "New Image";
x.add(option);
}
This is intended to allow image-picker to detect the additional item and hopefully display it.
But the additional attributes are ignored. I'd really appreciate some help please, as I'm going out of my mind. Thanks