Jquery background input animation

Asked

Viewed 91 times

0

Dear friends, I would like to do the following.

I have two buttons, one interferes with the other’s value. When a field is changed I want the other field to gain a background and return with the background to normal, with a certain animation in a few seconds.

I am using JQUERY 3.1.1

  • 1

    Do you already have something? Explain a little more what you want, what you already have, etc. This way it will be easier for someone to help you

1 answer

0


You can use .Animate() for that. 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>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<button id=btn1>
  TESTE
</button>
<button id=btn2>
  RESULTADO
</button>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.