$(document).ready(function() { $('head').append(" <script> /* Trying to insert into HEAD */ </script> "); /* End of the lines to append */ });