jQuery Target the same element (111) Problem

jQuery Target the same element (111) Problem
0.0 0

#1

I thought I had this figured out:

I searched the forum and found that this is working code:

> <script>
> $(document).ready(function() {
> $("button").addClass("animated");
> $(".btn").addClass("shake");
> $("#target1").addClass("btn-primary");
> $("#target1").addClass("animated shake btn-primary");
> });
> </script>

I guess I am looking for someone to explain to me why the last : $("#target1").addClass(“animated shake btn-primary”);

is needed? Wouldnt #target1 inherit those properties already from the “button” and the “btn” class calls above? I’m new to jQuery obviously :slight_smile:

THanks for your help answering my question.


#2

I think the issue is on line6 you have a pound sign (#) in front of the btn-primary class:

$("#target1").addClass("#btn-primary");

If you remove that I think it should work. And then your original assumption would have been correct. My code looks the exact same as yours minus the pound sign and it passed all tests. Let us know if that does not correct the problem.