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