I have a web page index.php, I want to add and remove JS files to this page dynamically
So far I did,
<script type="text/javascript" src="" id="dynamic_files"></script>
I had planned to change the src of this script tag by
function loadJsfiles( filename ){
var filePath = 'include/js/'+filename;
$("script#dynamic_files").attr('src',filePath);
};
and the included js file has script tags in it:
document.write('<script type="text/javascript" src="include/js/profile1.js"></script>');
document.write('<script type="text/javascript" src="include/js/profile2.js"></script>');
document.write('<script type="text/javascript" src="include/js/profile3.js"></script>');
document.write('<script type="text/javascript" src="include/js/profile4.js"></script>'); –
My question is that,
will that script tag printed in to my document page, if so how do I remove it
Reference: Dynamic js files