Error message: Uncaught TypeError: Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'.
I want to concatenate the string after the corresponding tr when the addChild method is triggered. How should I write addChild?
-----renew
Dear friends who answered, thank you, the problem is solved, I used the method on the first floor
The first parameter requirement is that the Dom node is not a string
Try
insertAdjacentHTML
tpl is a string, not a node object, so an error is reported;
You can use event bubbling to write the addChild method on tr or tbody (depending on whether each tr requires this method),
then use the event object Use the target attribute to find the corresponding tr, and then perform subsequent operations;
The error message is very obvious, tpl is a string, not a node element
https://developer.mozilla.org...
You have to convert the string into dom
For example, a function like this is used to convert a string into DOM. The code is only for reference