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

167
Views
Fabric.js: maxlength for iText-Element doesn't works

i found here on stackoverflow a post how to add a maxlength to an iText-Element in Fabric.js. This was the solution:

text.on('editing:entered', () => {
     text.hiddenTextarea.setAttribute('maxlength', 20);
});

This code worked for me. But today this code doesn't work anymore. I don't have an idea why it is so. I haven't changed something at this function.

This is my Code to add the iText to the canvas:

function addiText(){

let newText = new fabric.IText('Testname', { left: 150, top: 150, fontSize: 24, fill: "#0c0c0e", fontFamily: "Arial" });
        
newText.on('editing:entered', () => {
    newText.hiddenTextarea.setAttribute('maxlength', 10);
});
        
canvas.add(newText);
canvas.setActiveObject(newText);

let activeObject = canvas.getActiveObject();
setProperties(activeObject);

return activeObject;
}

Can anyone say me, why this doesn't work anymore?

about 4 years ago · Juan Pablo Isaza
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!