Input animation in Jquery background

0

Dear, I would like to do the following.

I have two buttons, one interferes with the value of the other. When one field changes I want the other field to gain a background and it comes back with the background to normal, with a certain animation in a few seconds.

I'm using JQUERY 3.1.1

    
asked by anonymous 05.05.2017 / 15:26

1 answer

0

You can use .animate () for this. Add the script " jquery-ui.js "

$('#btn1').click(function() {
  $('#btn2').animate({
    backgroundColor: '#000000'
  }, 1000, function() {
    $('#btn2').animate({
      backgroundColor: ''
    }, 1500)
  });
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<button id=btn1>
  TESTE
</button>
<button id=btn2>
  RESULTADO
</button>
    
05.05.2017 / 18:41