Want help not sure what i am doing wrong


#1


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

For some reason it doesn't click blue, am i missing something or doing it incorrectly?


var main = function() {
  $(".btn").click(function() {
    $("btn-like").toggle();
  $(this).toggleclass("active");
 
  });
};

$(document).ready(main);


#2

Hi @danny1528,

Look closely at your selector on line 3 :slight_smile:

Hint (click to view)

You need a dot (.) before the class name, otherwise the computer tries to select the <btn-like> tag, which doesn't exist. Your selector should look like this instead:

$(".btn-like")

#3

hmm... i tried this but it still doesn't turn blue maybe its a bug.

var main = function() {
$(".btn").click(function() {
$(".btn-like").toggle();
$(this).toggleclass("active");

});
};

$(document).ready(main);


#4

Not a bug, I accidentally missed one more thing: toggleclass(...); needs to be camelCased, like this: toggleClass(...);. Fix that, and your code should work :slight_smile:


#5

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