parent()

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 <div></div> 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.

उदाहरण

सिंटैक्स

parent(parent)
parent()

पैरामीटर्स

parent
String|p5.Element|Object:

ID, p5.Element, or HTMLElement of desired parent element.

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

संबंधित संदर्भ