# Help with small change to javascript?

**URL:** <https://forum.kirupa.com/t/help-with-small-change-to-javascript/331601>\
**Category:** web dev\
**Created:** [September 7, 2013, 6:53pm UTC](https://forum.kirupa.com/t/help-with-small-change-to-javascript/331601 "2013-09-07T18:53:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eabigelow](https://avatars.discourse-cdn.com/v4/letter/e/eada6e/32.png) [@eabigelow](https://forum.kirupa.com/u/eabigelow)\
**Post date:** [September 7, 2013, 6:53pm UTC](https://forum.kirupa.com/t/help-with-small-change-to-javascript/331601/1 "2013-09-07T18:53:30Z")

</div>

Hi–

I am using the following code to trigger an animation to begin again (start over) by clicking on a button. Instead, I would like to trigger the same action when the page loads so no button is involved.

Is there a way to convert this code to do that? Many thanks for any help!

```auto

<script type="text/javascript">
            $(document).ready(function(){
    $('button').on('click', function(){
        $('img').attr('src', 'animations/washington.gif');
 
    });
 
});
            </script>       

```
