Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda