Привет, у меня есть вопрос о динамическом создании холста с помощью javascript.
Я создаю холст, подобный этому:
var canvas = document.createElement('canvas');
canvas.id = "CursorLayer";
canvas.width = 1224;
canvas.height = 768;
canvas.style.zIndex = 8;
canvas.style.position = "absolute";
canvas.style.border = "1px solid";
но когда я попытаюсь найти его, я получаю значение null
:
cursorLayer = document.getElementById("CursorLayer");
Я делаю это неправильно? Есть ли лучший способ создать холст с помощью JavaScript?