title: Javascript For Loop executes repeatedly in Chrome plugin, but only once from console
body: <p>I'm quite new to Chrome extensions and am banging my head against a wall here. I have a JS for loop that executes once in the console and works absolutely perfectly. However when I add the loop into my plugin, it loops 42 times. Here is the loop:</p>
  
  <pre><code>var a;
  var b = 0;
  $("div").dblclick(function()
  {
  
      for (a=0;a &lt; document.querySelectorAll("div.sectionRowComponent").length;a+=1)
      {
          try
          {
              if(document.querySelectorAll("div.sectionRowComponent")[a].getElementsByTagName("input").length &gt; 0)
              {
              console.log (a + ":" + document.querySelectorAll("div.sectionRowComponent")[a].getElementsByTagName("span")[1].innerText + document.querySelectorAll("div.sectionRowComponent")[a].getElementsByTagName("input")[0].value);
              }
          }
  
          catch(err)
              {
  
              }
  
      }
  console.log(b+=1);
  console.log(a);
  
  })
  </code></pre>
  
  <p>Variable a (how many section row components) returns 162, while variable b (how many times the loop runs) returns 42.</p>
  
  <p>As I said, this code executes perfectly in the console, but 42 times in a plugin. There is nothing else in the plugin to interfere with it. The manifest has only one reference to a js file and the rest is HTML5 without any script at the moment. </p>
  
  <p>For clarity, here is my manifest:</p>
  
  <pre><code>{
  "browser_action": {
        "default_popup": "encrypt.html" //this is an empty file just now
      },
  
      "content_scripts": [
          {
              "matches": ["https://an.address.zul*", "https://another address.zul"],
              "js": ["jquery-3.3.1.min.js", "theScript.js"]   
          }
      ]
  
  }
  </code></pre>
  
  <p>EDIT: Sorry, I should add that vars a and b were only added to test the loop after the strange behaviour started.</p>