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

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты