Skip to content

Is there a way you can delete DOM elements? #2288

@sosunnyproject

Description

@sosunnyproject

Hello! It's my first time writing here, so I apologized in advance if this is the wrong place to write this. I will remove it quickly.
As far as I have tried, I can't find a way to delete DOM elements like
header = createElement('h2', 'title')
button = createButton('submit')
in sketch.js file.

Once they are created, they don't get removed by clear() or setup() functions. I tried to make customized function that reset the canvas, but those wouldn't delete the buttons or elements above.
Please let me know if there's already a way to do this easily, if not, I would love to know a way-around.

Nature of issue?

  • [X ] New feature request

Most appropriate sub-area of p5.js?

  • [ DOM elements ] Other (specify if possible)

Which platform were you using when you encountered this?

  • [ X ] Desktop/Laptop

Feature enhancement details:

Cannot find how to reset/clear already created dom elements in the canvas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions