Would this work? FCC "Remove Classes from an element with jQuery" Challenge

Would this work? FCC "Remove Classes from an element with jQuery" Challenge
0

#1

for “Remove Classes from an element with jQuery” Challenge.

$("#target1").removeClass("btn-default");
$("#target6").removeClass("btn-default");
$("#target5").removeClass("btn-default");
$("#target2 ").removeClass("btn-default");
$("#target3").removeClass("btn-default");
$("#target4").removeClass("btn-default");

can this be changed to this

$("#target1 #target2 #target3 #target4 #target5 #target6").removeClass("btn-default");

I thought it was the same thing.


#2

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.


#3

The challenge is to remove the class from all of your button elements, so I advise targeting them by that rather than by id.

To answer your question though, you can target multiple identifiers in jQuery but you need commas. Always check the documentation.