Code doesn't do what it is supposed to do. The boxes don't dissapear


#1

https://www.codecademy.com/en/courses/web-beginner-en-GfjC6/1/2?curriculum_id=50a3fad8c7a770b5fd0007a1#


$(document).ready(function() {
    $('.vanish').click(function$('button') {
       $('.vanish').fadeOut('slow'); 
    });
});


#2

That selector looks very out of place. In that part of the syntax we would expect only (). Does the button selector belong at the beginning?


#3

In lesson 6, the instructions said to put button inside of $(), so I thought that meant $('button')


#4

Reset your code and see if anything jumps out.


#5

$(document).ready(function() {
$('.vanish').click(function() {
$('.vanish').fadeOut('slow');
});
});

This is the code I had at first and it makes the divs disappear but I don't pass the lesson. I reviewed my notes and this code seems correct but the code in my original post somehow passed the lesson. I know that isn't relevant but it just seemed strange.


#6

The code we are given has,

$().click(function(){

in the second line. We are instructed to write a button selector. Where will you insert, 'button'?


#7

$(document).ready(function() {
$('button').click(function() {
$('.vanish').fadeOut('slow');
});
});

I thought that I always had to put the name of the div in that parenthesis to affect it. Thanks, finally got back on and figured it out.


#8

A post was split to a new topic: $e(...).a.cacher is not a function


#9

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