I would like to be able to click on the Orange text to be able to call the orange.js file, then load the .js file into the myTableResult div. I would like the name of the .js file to be inside the onclick event. Can somebody help me with that?
<a onclick="getScript('Orange.js');"/>Orange</a>
<div id="myTableResult">
</div>
<script type="text/javascript" src="/myapp/htmlCode"></script>
if you are using jquery, you can use:
to get the script and execute whatever command you want in the after load section (call functions, .etc).
if you are using vanilla javascript, then you need to first add your script to document body and then call any function you want like this:
And to pass result to your element you need to do
jquery:
vanilla js:
document.getElementById("myTableResult").innerHTML="your_html_goes_here"