javascript - unable to remove canvas and change src by their id : fabric js -
I want to remove canvas from my ID, I tried to specify the ID, calling the method of deletion But it does not work: JS code var canvas = new fabric.Canvas ('c'); Function getObjectById (id) {canvas.forEachObject (function) (if (o.id === id) {return o;}}}; return tap;} var img = "http://edudemic.com/wp -content / uploads / 2012/09 / jail_photo.jpg "; Fabric.Image.fromURL (img, function (source) {img = source.set ({left: 0, top: 0, angle: 0, id: 'Hollat '};); Canvas.ed (IMG); canvas.reader all ();}); Document.getElementById (' download '). Onclick = function () {warning (' is '); var removeit = getObjectById (' move '); Canvas.remove (removeit);}; Document.getElementById (' changeimage '). Onclick = function () {Warning (' is'); GetObjectById ('moveit') src = "http: // www. Meandmylaptop.com/uploads/5/8/1/2/5812329/7801574.png "; canvas.renderAll ();}; Document.getElementById ('changeimage...