So I have an extension that injects some html so that the bottom right of the screen shows some of my bookmarked websites. I want to be able to click on these elements and run code inside of my content script. Since I can access all dom elements, I thought I could do this by simply using an onclick but apparently I don't understand the scope of a content script and the page itself.
The html/css is injected via the content script and the template is imported to a host element creating a shadow dom. I didn't think shadow dom affected js scope but it's a possibility.
I have already injected some html so the possible duplicate does not apply.
the onclick looks like..
<div onclick="selectLink(0)">Link</div>
and in my content script I have
// changes the groups coresponding tab to the url specified by link
function selectLink(){
var indexes = null;
ship("select-link", {}, {}, indexes.group, indexes.link);
}
I have been struggling with this for a while. I just don't understand how to send events to to my app from the pages context. Do I need to add listeners? Idk, thanks for the help.