China Naming Network - Eight-character Q&A - Write a button (js) with div.

Write a button (js) with div.

1. First, open hbuilder, create a new html file, and write the input button to set the id attribute and bind the event of adding the button:

2. Then write the button event function in the script tag below. First, use the createElement function to create an input tag, set the type property and the value property, and finally add a listening event to the new button. Click to create a button, and finally call it at the outermost layer of the function.

3, finally open the browser, you can see a button to add a button:

4. Click this button several times, and a new button line will be created below: