I have a system that will make a new button for a forEach(). Here is the code for that:
r.forEach(room => {
socket.on('chat message', (m, i) => {
let li = $(`<li><button id="${m[i]}">${m[i]}</button></li>`)
$('#events').append(li)
})
});
How would I make a .click() listener for each button?