Consider the following code snippet. It should slide up the button that was clicked. In which line there is a logical error?

1) $(".button").click(
2)      function(){
3)          $(".button").slideUp(500);
4)      });
Explanation
The error is at line 3. When we click at any button we will slideUp all buttons with class "button". You must use $(this) instead of $('button') inside the event handler. Example:

$(".button").click(
      function(){
          $(".button").slideUp(500);
     });

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes