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

223
Views
Konva setAttr not a function error for children

I'm using Konva and trying to change the fill color of a tag using the setAttrs, however I keep getting an error "setAttrs is not a function" I'm trying to start by getting a child of the label, and setting the attribute of that. Any thought's on what I could be doing wrong?

// Add labels for each IO
      var IO = new Konva.Label({
        x: 10,
        y: 10,
        name: "Tag 1",
      });

      IO.add(
        new Konva.Tag({
                fill: '#C1EFF5',
                stroke: '#555',
                strokeWidth: 2,
        })
      );

      IO.add(
        new Konva.Text({
          text: "TestText",
          fontFamily: 'Calibri',
          fontSize: 12,
          padding: 5,
          fill: 'black',
        })
      );
            
    // Add listening Events such as clicking
    IO.on('click', function () {

        // get only Tag
        var tagsClicked = this.getChildren(function(node){
            return node.getClassName() === 'Tag';
        });
        tagsClicked.setAttrs({
            fill: 'red'
        });
    });
            
    // Add the input to the group for display
    group.add(IO);
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!