Trying to dynamically change src attribute for js file.
<script id='mod' src="arts.js"></script>
<script src="main.js"></script>
inside arts.js I have:
$(document).on('click', function(){
console.log('arts');
});
Inside banns.js I have:
$(document).on('click', function(){
console.log('banns');
});
Inside the main.js I have:
$(document).on('contextmenu', function(){
$('#mod').attr('src', 'banns.js');
});
After a right click I'm expecting the next click to write banns but it doesn't work.
Is it possible (without reloading the page)?