Phaser API Documentation

  Version: 

Member of: Phaser.DOM

<static> AddToDOM(element, [parent])

Description:

Adds the given element to the DOM. If a parent is provided the element is added as a child of the parent, providing it was able to access it. If no parent was given it falls back to using document.body.

Parameters:

name type arguments description
element HTMLElement

The element to be added to the DOM. Usually a Canvas object.

parent string | HTMLElement <optional>

The parent in which to add the element. Can be a string which is passed to getElementById or an actual DOM object.

Returns:
Description:

The element that was added to the DOM.

Type:
  • HTMLElement
Since: 3.0.0
Source: src/dom/AddToDOM.js (Line 7)