Panky26 Panky26 - 3 months ago 10
Javascript Question

unable to get property 'queryselectorall' of undefined or null reference

i got below metioned error in my jquery function

var timer = document.getElementById(id);
var pdays = timer.querySelector('.days');
var phours = timer.querySelector('.hours');
var pminutes = timer.querySelector('.minutes');
var pseconds = timer.querySelector('.seconds');


0x800a138f - JavaScript runtime error: Unable to get property 'querySelector' of undefined or null reference

please suggest me where i can find jquery file for .queryselectorall() method or remove above mentioned error in jquery code ?

Answer

here is a suggestion! maybe your JavaScript is executing before your page loads so your document.querySelectorAll() code is returning data with undefined or null reference (zero length).

try to wrap with onload()

onload = yourFunction(){
document.querySelectorAll()
}
Comments