console.log(document.getElementById("myCanvas").style.length);
I have this code in my program. It returns 0, despite the length of the canvas being 660. Does anyone know why?
console.log(document.getElementById("myCanvas").style.length);
I have this code in my program. It returns 0, despite the length of the canvas being 660. Does anyone know why?
You can get the width and height through this.
var canvas = document.getElementById("myCanvas");
var width = canvas.width;
var height = canvas.height;
In CSS there is no length attribute, there is just height or width. You can use this:
console.log(document.getElementById("myCanvas").style.height);
console.log(document.getElementById("myCanvas").style.width);