I am trying to create a group to an object that I have put in the DOM but I don't know how since it doesn't have a key to set it in the preload() function I have preloaded a span element, and in the create() I have created an element in the DOM.
preload(){
this.span = document.createElement('span')
}
create(){
this.img = '/assets/sprites/shouko.png'
this.span.style = `background: url("${this.img}"); background-size: cover; width: 60px; height: 60px; font-weight: bold`;
this.element = this.add.dom(400, 300, this.span)
this.physics.add.existing(this.element, false);// add sptite
this.element.body.setOffset(-(this.element.displayWidth / 2), -(this.element.displayHeight / 2));
this.element.body.setVelocity(100, 200);
this.element.body.setBounce(1, 1);
this.element.body.setCollideWorldBounds(true);
}