How can I change an element tag without losing handlers?

  • 0
    Is it possible to change the tag of an element without losing the handlers installed on the element?
    JavaScript Caleb Zhang, May 25, 2020

  • 2 Answers
  • 0

  • 0
    Change? It's basically impossible to change it.

    You can only delete an element and create a new one in its place. Naturally, all handlers will be lost.

    The answer is no.

    To be honest, just curious, but what is it for? In all my practice, there has never been such a need))
    Sebastien Navarro

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!