I have this HTML list and input:
<li>
<span>19</span>
</li>
<li>
<span>20</span>
</li>
<li>
<span>21</span>
</li>
<li>
<span>22</span>
</li>
<li>
<span>23</span>
</li>
<li>
<span>24</span>
</li>
</ul>
<input type="text" id='lotto' value='' readonly>
</div>
and this external JavaScript code to get the value of each span I click on in an array
let clicks = 0
let numbers = []
$(document).on('click', 'li', function(event) {
if (clicks < 6) {
numbers[clicks] = parseInt($(this).find('span').html())
}
console.log(numbers)
clicks++
})
is there any possible way to display the spans i clicked on in the input ??