title: Very simple javascript doesn't work at all
body: <p>My JavaScript in .php (static website) file doesn't work. I use there 3 other scripts and they do work, but not this one.</p>
  <p>The situation is simple</p>
  <p>The JavaScript is:</p>
  <pre><code>var myFile = document.getElementById('myFile');
  
  myFile.addEventListener('change', function() {
  
    alert(this.files[0].size); 
  });
  </code></pre>
  <p>and the HTML code in the PHP file is (stripped):</p>
  <pre><code>&lt;form onsubmit=&quot;return anotherfunction();&quot; action=&quot;sendForm.php&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;    
    &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Attach an image:&lt;/td&gt;
          &lt;td&gt; &lt;input type=&quot;file&quot; name=&quot;priloha[]&quot; accept=&quot;image/*&quot; /&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  <p>And the JavaScript does nothing, it acts like it doesn't exist. I tried to use the JS in the header, below the header, in the body, in the TD of the input... I also tried using it in external .js file, nothing, doesn't work at all. I tried changing &quot;change&quot; to &quot;click&quot;, didn't work neither. I tried to do this all day and I can't figure out what's wrong.</p>
  <p>So I tried to do much simpler code to check what's wrong and it seems like <code>change</code> or <code>onchange</code> - the second line of the JS doesn't work.</p>
  <p>I also tried to specify HTML5 doctype, doesn't do a thing.</p>
  <p>My extra .html file to try even simpler code looks like this and of course doesn't work...</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;      
    &lt;/head&gt; 
    &lt;body&gt;
      &lt;table&gt; 
          &lt;tr&gt;
              &lt;td&gt;Input field for click popup:&lt;/td&gt;
              &lt;td&gt;
                  &lt;script type=&quot;text/javascript&quot;&gt;
                  var input = document.getElementById('input');
                  input.addEventListener('click', function() {
                  alert(&quot;Hello&quot;); 
                  });
                  &lt;/script&gt;
              &lt;input type=&quot;text&quot; id=&quot;input&quot; /&gt;
              
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;table&gt;
      &lt;/body&gt;  
  &lt;/html&gt;
  </code></pre>
  <p>Help me please, I don't really know what's this...
  I forgot to mention, I tried different browsers - Opera 12.15, latest Firefox and Chrome, didn't work in any case. But it works in fiddle...</p>