I am trying to run an external script that I cannot edit. Currently I am calling upon the script when the page loads. This slows my site down. I would like to instead call the javascript file and run the function when it is clicked. I made it a little faster by calling the function, when clicked. However, it still calls the javascript file because I don't know how to make it call that and the function, when clicked. I spent a few hours reading and trying to find a similar request on Google with no success.
Below you will see what I have came up with so far.
<div id="myFunctionID" style="background: url('http://example.com/button.png') repeat
scroll 0 0 transparent; width: 100px; height: 50px; cursor: pointer; position:fixed;
bottom:0; left:0;">
</div>
<script type="text/javascript" src="https://externalScript.js"></script>
Please help me load the JS
file and the myFunctionID
, when the button image is clicked.