jQuery Form How to - Click to hide button in animation








Question

We would like to know how to click to hide button in animation.

Answer


<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head><!--from  w ww  .j  av a2  s .  co m-->
<body>
  <button>Start Animation</button>
  <script>
$(document).ready(function(){
  $("button").click(function(){
    $("button").animate({width:'0px', padding:'0', border:'0'});
  });
});
</script>
</body>
</html>

The code above is rendered as follows: