Clear Images
Understand how to build a clear images feature by creating a button with an event listener to delete photo references from Firestore. Learn to query Firestore, loop through documents, and remove image data from your Firebase-powered image sharing application.
Set up Your Clear Button #
We start by creating an HTML button. We will add an id to it, so we can attach an event listener to it with our JavaScript. Since it’s a button, the event we want to listen for is a click. We will get to that in a moment but as you can see from the code below, the HTML is pretty straight forward.
We will be using all the code from the previous lessons as we build in the additional functionality of clearing the photos.