How do I use a combination of event objects, eventlisteners, and child elements to create the amount of buttons the user selects from a prompt

I am trying to use a combination of event objects, event listeners and child elements to create the amount of buttons a user selects from a list.

Full code for buttons and selections below

<div id=buttons>
        
How many buttons would you like?

<label>1 <input name=numberButtons type=radio value=1></label>
<label>2 <input name=numberButtons type=radio value=2></label>
<label>3 <input name=numberButtons type=radio value=3></label>
<label>4 <input name=numberButtons type=radio value=4></label>
<label>5 <input name=numberButtons type=radio value=5></label>
<label>6 <input name=numberButtons type=radio value=6></label>
<label>7 <input name=numberButtons type=radio value=7></label>
<label>8 <input name=numberButtons type=radio value=8></label>
    
</div>
     
<span id=done>Done</span>

The id=done is the button that is clicked to create said buttons

I tried creating a function but it did nothing.