Basically what I want to do is, using JQuery, add a script directly before the closing body tag on a page.
AKA
SCRIPT HERE
</body>
Is there a way to do this, and if so, how?
tag in a page?
Basically what I want to do is, using JQuery, add a script directly before the closing body tag on a page.
AKA
SCRIPT HERE
</body>
Is there a way to do this, and if so, how?
use can use $('body').append('<script></script')
Update: Looks like this maynot work always
So Try
var script = document.createElement("script");
script.type = "text/javascript";
script.text = "alert('voila!');" // use this for inline script
script.src = "path/to/your/javascript.js"; // use this for linked script
$('body').append(script)
Demo: Fiddle
firstly add a footer div right befor </body>
like this <div id="footer"></div>
then :
$('#footer').after('<script type="text/javascript">SCRIPT HERE</script>');