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
Зареєструйся Зараз
або Підпишись на майбутні тести