Reference createElement()

createElement()

Creates a new p5.Element object.

The first parameter, tag, is a string an HTML tag such as 'h5'.

The second parameter, content, is optional. It's a string that sets the HTML content to insert into the new element. New elements have no content by default.

Examples

Syntax

createElement(tag, [content])

Parameters

tag
String:

tag for the new element.

content
String:

HTML content to insert into the element.

Returns

p5.Element: new p5.Element object.
Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!

Related References