How do I select certain elements that have been added to the DOM dynamically?

How do I select certain elements that have been added to the DOM dynamically?

Hello,
I have a markup structure like this.

<div class="gallery">
        <div class="slide"></div>
</div>

I will be adding 3 additional <div class="slide"></div> after the first one dynamically on $(document).ready().  In the DOM, it looks like this.

<div class="gallery">
        <div class="slide"></div>
        <div class="slide"></div>
        <div class="slide"></div>
        <div class="slide"></div>
</div>

First, I append the divs like this
rootElement = $(".gallery");
rootElement.append('<div class="slide"></div>');
rootElement.append('<div class="slide"></div>');
rootElement.append('<div class="slide"></div>');

Then, I try $("div.slide").length after the elements were added, but I get only 1 element.  I want to get 4 elements.  How would I do this?  Thanks for reading.