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
  • 197,815
  • 30
  • 248
  • 265
ofek tal
  • 5
  • 3

0 Answers0