Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

8.14: parent() and child() again with Variables - p5.js Tutorial

16.5K views
•
October 26, 2015
by
The Coding Train
YouTube video player
8.14: parent() and child() again with Variables - p5.js Tutorial

TL;DR

Learn how to use the parent-child function with dynamically generated HTML elements in p5.js.

Transcript

in this video I want to look again at the parent-child function so it's a bit of a review of that function but I want to look at it in a slightly different context before the main reason that I looked at the parent function was to take a Dom element that I generated in code and insert it into another place in sort of the existing HTML so we just fi... Read More

Key Insights

  • 👪 The parent-child function in p5.js allows you to insert dynamically generated HTML elements into existing elements.
  • 📟 The create image function in p5.js generates an image Dom element that can be inserted into the HTML page separately from the canvas.
  • 🏪 Storing references to dynamically generated elements in an array can provide easy access for future manipulation and removal.
  • 📟 The p5 Dom library provides functions like remove and hide for removing or hiding elements from the page.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How can you use the parent-child function with dynamically generated HTML elements?

To use the parent-child function, you need to reference the ID of the HTML element you want to insert the generated element into. Pass the p5 variable containing the Dom element to the parent or child function, depending on whether you want to parent or child the element.

Q: What is the difference between create image and load image in p5.js?

The create image function generates an image Dom element that can be inserted into the HTML page separately from the canvas. On the other hand, the load image function is used to load an image file and draw it onto the canvas.

Q: How can you access the parent element of a dynamically generated element using p5.js?

By using the parent function with no argument, you can retrieve the parent element of a Dom element. This allows you to find the parent element and manipulate it accordingly.

Q: How can you remove dynamically generated elements from the page using p5.js?

You can use the remove function from the p5 Dom library to remove elements from the page. Loop through an array that stores references to the generated elements and call the remove function on each element to delete them.

Summary & Key Takeaways

  • The video explores using the parent-child function with dynamically generated HTML elements in p5.js.

  • It demonstrates how to insert elements into existing HTML using the parent function and a reference to a Dom element.

  • The video also covers creating image elements using the create image function and shows how to parent them to different elements.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from The Coding Train 📚

Coding Challenge #126: Toothpicks thumbnail
Coding Challenge #126: Toothpicks
The Coding Train
Computer Mouse Conference Demos! (node.js + tensorflow.js) thumbnail
Computer Mouse Conference Demos! (node.js + tensorflow.js)
The Coding Train
Classifying Poses with ml5.js Part 2 thumbnail
Classifying Poses with ml5.js Part 2
The Coding Train
9.4: Genetic Algorithm: Looking at Code - The Nature of Code thumbnail
9.4: Genetic Algorithm: Looking at Code - The Nature of Code
The Coding Train
Text Generation using Spell with Nabil Hassein thumbnail
Text Generation using Spell with Nabil Hassein
The Coding Train
8.1: Fractals - The Nature of Code thumbnail
8.1: Fractals - The Nature of Code
The Coding Train

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.