Check this code please, and help me solve why i'm getting type error document.getElementById(...) is null
function Dropdown(){
this.core = ['NIS', 'EUR', 'USD'];
this.check = function(){
var cho = '<select>';
for(x in this.core){
cho += '<option value="'+ this.core[x] +'">'+ this.core[x] +'</option>';
}
cho += '</select>';
return cho
};
}
var obj = new Dropdown();
document.getElementById("demo").innerHTML = obj.check();
on HTML file i have :
<div id="demo">Check Console log</div>
Thank you for any help.