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
Published on 05-Apr-2018 13:15:10
Advertisements