p5.js | createInput() Function
The createInput() function is used to create an input element in the DOM for accepting text input. The optional parameters can be used to set the type of input that can be entered. You can use the set() function to define the length of the box.
Parameters: This functione accepts two parameters as mentioned above and described below:
- value: This string parameter used to set the default value of the input.
- type: This is a string parameter which sets the type of input. It can have values such as ‘text’, ‘password’, etc for accepting text with that specific format.
Return Value: It returns a pointer to the p5.Element with the created node.
Below examples illustrate the createInput() function in p5.js:
Online editor: https://editor.p5js.org/