Can the HTML5 Canvas element be created from the Canvas constructor?

JavascriptWeb DevelopmentFront End Scripts

No, you cannot create the HTML5 Canvas from the canvas constructor. You need the following −

document.createElement('canvas');

Use the following −

var canvas1 = document.createElement("canvas");
canvas1.id = "canvas1";

document.body.appendChild(canvas1);
raja
Updated on 25-Jun-2020 06:08:16

Advertisements