'cannot read properties of undefined 'clientwidth' after jquery upgrade and migration

I have jquery 2.4.1 on a website and need to update it to 3.5.0 (or the latest) I have successfully updated in one file (and works in the page) but I need to also update in another file, the second file affects bar graphs in the website generated by HighChart.

I comment out the outdated jquery and paste the upgrade and migration directly below (please see image)

jQuery update and script added

Error message on console

I am wondering If I am supposed to keep the outdated jquery? or download the update jquery and add it to a folder? Can someone please advise me? I am new too this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source