Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  35] [ 2]  / answers: 1 / hits: 170290  / 12 Years ago, fri, december 14, 2012, 12:00:00

Althought I pushed a parameter to getElementById I wonder from where is this 'is null' error coming from?



TypeError: document.getElementById(...) is null
[Break On This Error]

document.getElementById(elmId).innerHTML = value;

Line 75


In addition to this i wonder why title and time did not show unless I click one of these playlist pictures?


More From » dom

 Answers
103

All these results in null:



document.getElementById('volume');
document.getElementById('bytesLoaded');
document.getElementById('startBytes');
document.getElementById('bytesTotal');


You need to do a null check in updateHTML like this:



function updateHTML(elmId, value) {
var elem = document.getElementById(elmId);
if(typeof elem !== 'undefined' && elem !== null) {
elem.innerHTML = value;
}
}

[#81414] Thursday, December 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
malaysias

Total Points: 619
Total Questions: 110
Total Answers: 107

Location: Czech Republic
Member since Thu, Aug 11, 2022
2 Years ago
;