How can I stop an ongoing animation in jQuery

Learn how to stop an ongoing animation in jQuery effectively using the `stop()` method.
jQuery, stop animation, jQuery stop(), animation control
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { $('#myElement').animate({ left: '250px' }, 5000); // Stop the animation after 1 second setTimeout(function() { $('#myElement').stop(); }, 1000); }); </script> <div id="myElement" style="position:relative; width:50px; height:50px; background-color:red;"></div>

jQuery stop animation jQuery stop() animation control