Can someone explain to me what these errors mean?
I need the answers for a school project.
Error 1 "Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null"
Error 2 "Uncaught TypeError: Cannot read property 'dom' of null"
Can someone explain to me what these errors mean?
I need the answers for a school project.
Error 1 "Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null"
Error 2 "Uncaught TypeError: Cannot read property 'dom' of null"
Share
Improve this question
edited Feb 3, 2016 at 20:49
Barett
5,9586 gold badges53 silver badges56 bronze badges
asked Oct 22, 2015 at 8:22
JobvdweerdJobvdweerd
611 gold badge1 silver badge3 bronze badges
2
-
4
You try to read some properties from a variable that is
null
. Don't you get more information in the messages, like line numbers or file-names? If you are getting them in a browser, all modern browsers have inspectors with good debuggers, try to use them. – Some programmer dude Commented Oct 22, 2015 at 8:26 - 1 Please post a Minimal, Complete, and Verifiable example – kittikun Commented Oct 22, 2015 at 8:36
1 Answer
Reset to default 4It means you are trying to use a property on something that is null. Make sure you have an object to operate on before trying to use the property. I.e getBoundingClientRect
expects a dom element.
One way to select a dom element is by id:
var element = document.getElementById('myElement');
More about selecting dom elements here.