simple chrome extension, onclick not firing
<p>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</p>

<p>in main.js</p>

<pre><code>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&lt;div.length; i++){
div[i].appendChild(button.cloneNode(true));}

function load(e){
   alert("Event is Clicked");}
</code></pre>

<p>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.</p>