Apply the class "btn-like" to the $(".btn")


#1



https://www.codecademy.com/en/skills/make-an-interactive-website/topics/jquery-events/jquery-click-try


I don't understand what I need to do. I've added the .toggleClass() and don't know what to do next or if the .toggleClass() I added is even correct or not. Can someone give me the code?

PS I didn't know in which category I should post this, so I randomly chose this one.


var main = function() {
  $(".btn").click(function() {
$(this).toggleClass('active');

  });
};

$(document).ready(main);


#2

Hi @detail900,

Here's the error message:

Apply the class “btn-like” to the $(".btn")

And here's your code:

toggleClass('active')

Can you spot the difference now?


Also, this is the correct subcategory for questions on that exercise :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.