Rails and ajax file upload - cannot read property 'innerHTML' of null error

Viewed 13145

I am developing a Rails app with a module for dynamic - ajax - image upload to gallery. I am doing it basing on this app - multi-file-upload-demo. I am not very keen in Javascript and stuff, so I copy a lot of logic from that implementation.

I made up my app following all logic from rounders demo, I have included all gems and javascript libraries, and I get an error:

Uncaught TypeError: Cannot read property 'innerHTML' of null 

in chrome console, which refers to tmpl.js file

tmpl.load = function (id) {
    return document.getElementById(id).innerHTML;
};

My knowledge of JS doesn't make it clear to me which piece of code triggers that function so I can go further.

Can you advise me what are the next steps to investigate source of this problem? I expect potential reasons may be various, so I don't want to paste all code from the application.

5 Answers
Related