So my code works, I just dont understand why the red 'Add' button needs to be clicked since it is just a random div. I went further and doubled the code for the button to make two of them, only the first one works though. Any explanations what makes the first one so special?
id is specific to it's element, and can't be shared by another element on the same page. So, I think that what's going on here is that jQuery is finding the first element with an
button, and stopping there.
If you change
class="button" for both of them, then change the
# in the selector to a
., I think it will work :)
Something I found helpful for keeping classes and ids straight was that each class has multiple students (elements), and each student has an id. The class is shared by many students (elements), but each students id is specific to them and not shared by anyone else. Does that help you?
thanks, changing the class worked. Changing it helped me understand i was missing the
part, which was making the div not random at all. It has been a long week, im a bit inattentive