Attaches the element to a parent element.
For example, a
element may be used as a box to hold two pieces of text, a header and a paragraph. The
is the parent element of both the header and paragraph.The parameter parent can have one of three types. parent can be a string with the parent element's ID, as in myElement.parent('container'). It can also be another p5.Element object, as in myElement.parent(myDiv). Finally, parent can be an HTMLElement object, as in myElement.parent(anotherElement).
Calling myElement.parent() without an argument returns the element's parent.
Examples
Syntax
parent(parent)
parent()
Parameters
parent
String|p5.Element|Object: ID, p5.Element, or HTMLElement of desired parent element.
Returns
p5.Element:
Notice any errors or typos? Please let us know. Please feel free to edit src/dom/p5.Element.js and open a pull request!