Reference createInput()

createInput()

Creates a text <input> element.

Call myInput.size() to set the length of the text box.

The first parameter, value, is optional. It's a string that sets the input's default value. The input is blank by default.

The second parameter, type, is also optional. It's a string that specifies the type of text being input. See MDN for a full list of options. The default is 'text'.

Examples

Syntax

createInput([value], [type])
createInput([value])

Parameters

value
String:

default value of the input box. Defaults to an empty string ''.

type
String:

type of input. Defaults to 'text'.

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