0
why my code gives an error of... Cannot read property 'getContext' of null... please help anyone.. Every possible things done, l
const ctx = document.getElementById("axes_line_chart").getContext("2d");
4 ответов
0
Can we see the whole code?
0
the only suggestion i can give you base on your current code is to use `?.` operator if it did'nt work please show more parts of your code
const ctx = document.getElementById("axes_line_chart")?.getContext("2d");
0
Gaurav 20 Double check that the parameter to getElementById() is the same as your canva's id
0
Wrap it into a function like this.
window.onload = function() {
const ctx = document.getElememtById(“your canvas id”).getContext(“2d”);
};