I pretty much wanted the extension to attach buttons in the existing website. I only have one script file in my app, which is main.js
in main.js
table = document.querySelectorAll("table.CG_list.searchList")[0];
div = table.getElementsByClassName("sectionExpandColumn");
var button = document.createElement("a");
button.setAttribute("class", "section");
button.setAttribute("id", "discussion");
button.innerHTML = "Discussion";
button.addEventListener('click', load);
for (var i=0; i<div.length; i++){
div[i].appendChild(button.cloneNode(true));}
function load(e){
alert("Event is Clicked");}
The buttons are successfully added but when I click the button, nothing is happening. I tried adding the script tag with main.js in the head, but no luck there also.