Hey guys at the moment i am trying to make a for loop to create some buttons in my html dont think about the alt.on function cause it is based on altv(GTA 5 Multiplayer Servers). I am getting from somewhere else the data of applist and with that data i am trying to make the buttons in a for loop the thing is that i want this buttons to be childs of a div that already exists with a classname in the html and i need to definde a onClick = "blafunction();" for the each button.
alt.on('data-from-server', (applist) => {
let app = JSON.parse(applist);
for (i = 0; i < app.length; i++) {
var button = document.createElement("button");
button.id = app.id;
document.body.appendChild(button);
};
});