Run ยป
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn1").click(function(){ $("#box").animate({width: "300px"}); }); $("#btn2").click(function(){ $("#box").animate({width: "100px"}); }); }); </script> </head> <body> <button id="btn1">Animate Width</button> <button id="btn2">Reset Width</button> <div id="box" style="background:green;height:100px;width:100px;margin:6px;"></div> </body> </html>