0

i have this function on js:

function get_days(){
    var daysDiv = document.getElementById("days"); // here is the error
    content = "";
    for (i = 1; i <= numberOfDaysInMonth; i++){
        content += "<li>" + i + "</li>";
    }
    daysDiv.innerHTML = content;
}

this is what I have in the HTML code:

<ul id="days"></ul>

the error is:

Uncaught TypeError: Cannot set properties of null (setting 'innerHTML').

I don't know why, but it thinks that the variable daysDiv is null.

j08691
  • 204,283
  • 31
  • 260
  • 272
ofek tal
  • 21
  • 3

0 Answers0