Currently I am doing it like this:
function createPlayer(id) {
var playerWrapper = document.createElement("div");
document.body.appendChild(playerWrapper);
var player = document.createElement("div");
playerWrapper.appendChild(player);
var Player = {
wrapper: playerWrapper,
player: player
}
}
Just wondering if this is the best way or if there is some way I can create dom elements and the object at the same time? The object will also have methods attached. There will also be multiple instances of the object and associated elements.