Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Uncaught TypeError: Cannot create property 'style' on string 'wtd_background_image'

My wordpress plugin works with fabric.js 1.2.0, When I change it to work with fabric.js 1.7.9 then it throws the error on all the pages other than plugin page:

Cannot create property 'style' on string 'wtd_background_image'

on the following line:

canvasObj= new fabric.Canvas('wtd_background_image');

enter image description here

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You'll need to create an HTML Canvas Element with an id wtd_background_image, on all your pages.

let canvas = new Canvas('wtd_background_image');
let canvasObj = new fabric.Canvas('wtd_background_image');

function Canvas(id) {
    this.canvas = document.createElement('canvas');
    this.canvas.id = id;
    document.body.appendChild(this.canvas);
    return this.canvas;
}

// for demonstration
let circle = new fabric.Circle({radius: 20, fill: '#07C', left: 30, top: 30});
canvasObj.add(circle);
<script src="http://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.7.9/fabric.min.js"></script>

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!