I recently wrote a project that used innerHTML. However, I found that after calling innerHTML, onclick failed. This is also expected, because innerHTML is a button inserted in the form of text, so the onclick event cannot be recognized. We have to find another way out. We cannot implement it directly, but we can achieve it indirectly. Here is an example:
Example 1: This example cannot be implemented onclick