Is it possible to append to innerHTML without destroying descendants' event listeners?

前端 未结 13 1162
悲哀的现实
悲哀的现实 2020-11-21 23:40

In the following example code, I attach an onclick event handler to the span containing the text \"foo\". The handler is an anonymous function that pops up an <

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 00:05

    something.innerHTML += 'add whatever you want';

    it worked for me. I added a button to an input text using this solution

提交回复
热议问题