Title: Please use the new &#8220;on(load)&#8221; function
Last modified: October 28, 2021

---

# Please use the new “on(load)” function

 *  Resolved [puregraphx](https://wordpress.org/support/users/puregraphx/)
 * (@puregraphx)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/please-use-the-new-onload-function/)
 * The current version causes a JS error as WP Migrate is no longer loaded in WP
   core.
    Please replace:
 * `jQuery(window).load(function() {`
    with `jQuery(window).on('load', function(){`
 * in audio-album.php line 144 to fix
 *     ```
       jquery.min.js:2 Uncaught TypeError: e.indexOf is not a function
           at S.fn.init.S.fn.load (jquery.min.js:2)
           at (index):388
       S.fn.load @ jquery.min.js:2
       (anonymous) @ (index):388
       ```
   
 * I hard coded this fix and it solved the JS error.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [cubecolour](https://wordpress.org/support/users/numeeja/)
 * (@numeeja)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/please-use-the-new-onload-function/#post-15016054)
 * Thank you. I will look into this and update the plugin
 *  Thread Starter [puregraphx](https://wordpress.org/support/users/puregraphx/)
 * (@puregraphx)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/please-use-the-new-onload-function/#post-15484282)
 * Hi, 4 months later this issue still isn’t fixed. We still get
 *     ```
       Uncaught TypeError: e.indexOf is not a function
           at S.fn.init.S.fn.load (jquery.min.js?ver=3.6.0:2:84932)
           at (index):299:16
       S.fn.load @ jquery.min.js?ver=3.6.0:2
       (anonymous) @ (index):299
       ```
   
 * The only way to currently load the players is to enable jQuery Migrate script.
 *     ```
       <script type='text/javascript' id='audioalbum-js-after'>
       jQuery(window).load(function() { jQuery(".albumtrack").css("visibility", "visible"); jQuery(".track").css("background-image", "none"); });
       </script>
       ```
   
 *  Plugin Author [cubecolour](https://wordpress.org/support/users/numeeja/)
 * (@numeeja)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/please-use-the-new-onload-function/#post-15491580)
 * The plugin has been updated

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Please use the new “on(load)” function’ is closed to new replies.

 * ![](https://ps.w.org/audio-album/assets/icon-256x256.jpg?rev=1485171)
 * [Audio Album](https://wordpress.org/plugins/audio-album/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/audio-album/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/audio-album/)
 * [Active Topics](https://wordpress.org/support/plugin/audio-album/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/audio-album/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/audio-album/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [cubecolour](https://wordpress.org/support/users/numeeja/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/please-use-the-new-onload-function/#post-15491580)
 * Status: resolved