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)      });
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:


Follow CodeGalaxy

Mobile Beta

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