I'm trying to get the images src URL and add an "" tag to it using JS and a chrome context menu. I'm new to JS and coding in general and was wondering if I'm on the right track.
chrome.contextMenus.create({
title: "Copy and add <img src>",
contexts:["image", "link"],
onclick:copyToClipboard
});
function copyToClipboard(info){
var srcURL = "<img src=\""+info.srcUrl+"\">";
srcURL.select();
document.execCommand('copy', false, null);
}
Right now it doesn't do anything.. I get an error saying select() is not a function. 🤔