I am adding my external .js file as
<head>
<script type="text/javascript" src="service/js/test.js"></script>
</head>
Inside the test.js
I have one function called functionTest()
.
Calling this function onload of the body is working fine;
<body onload="functionTest()">
</body>
My Question is:
I want to call this function two time in the two different divs. How should I achieve this ?
<body>
<div id="left">
<!-- Directly Want to call functionTest() when div is getting loaded -->
</div>
<div id="right">
<!-- Directly Want to call functionTest() when div is getting loaded -->
</div>
</body>
Add the call to the function at the end of the
div
. The functionfunctionTest
will be called when thediv
is completely loaded.