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

1

i am getting 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 ?

javascript
jquery
javascript-events
asked on Stack Overflow Aug 30, 2016 by M.Y.Mnu • edited Jul 10, 2018 by M.Y.Mnu

1 Answer

2

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()
}
answered on Stack Overflow Aug 30, 2016 by Simo

User contributions licensed under CC BY-SA 3.0