Hi,
Is it possible to insert a script tag to a head element of an html file using jQuery? I tried a couple of methods, but none worked. I don’t see the script but the script is getting executed.
But I’m able to do it using plane javascript and dom.
Eg:
using jQuery
$(document).ready(function() {
$('<script type="text/javascript">alert("hi - appendTo");</script>').appendTo('head');
$('head').append('<script type="text/javascript">alert("hello append");</script>');
});
// gets the alert, but I don't see the appended script tags in elements (chrome dev tools)
Other tags like div shows up.
Thanks.