I am trying to append a script tag with a script on the head of a page, but I am appending the code and it doesnt work. Probably because the page is already running.
How can I have something like this work?
$(document).ready(function () {
$('a').on('click', function () {
$('head').append('<script>console.log("running")</script>');
});
});