How do I access the dom element I'm creating?

  • 0
    Please tell me, I have a functionality that creates elements, how can I access them later? I created a table through the dom with a certain class, but I can’t access it through QuerySelector, QuerySelectorALL, etc., as a result, when you click on delete - & gt; remove selected element

    https://jsfiddle.net/8aw6mtoq/
    JavaScript Anonymous, May 7, 2020

  • 1 Answers
  • 0
    When creating a TR, you need to hang a unique ID on it.

    And also when creating a button to delete in TR, hang on the onclick button or addEventLisner

    with the id of this tr.

    And you will have a function like del (id)

    where you look for tr by id and remove it



    this is the easiest option
    Hannah Gallagher

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