It would be helpful to know what version of drupal you are using.
Modifying html.tpl.php
to add Javascript like this is really a bad choice as it is a very brittle way of coding something.
Jquery in Drupal 7 is loaded using the noConflict
mechanism. This avoids javascript namespace collisions:
Many JavaScript libraries use $ as a function or variable name, just
as jQuery does. In jQuery's case, $ is just an alias for jQuery, so
all functionality is available without using $. If we need to use
another JavaScript library alongside jQuery, we can return control of
$ back to the other library with a call to $.noConflict():
If you wanted to use code like you've written you would write:
<script>
jQuery(document).ready(function() {
alert('hi');
});
</script>
You're better off adding a scripts[]
entry into your theme_name.info
file and placing such code in its own javascript file in your theme directory. Drupal will load it into the HTML <head>
for you and aggregate your javascript files for you if you have aggregation turned on.
# In YOURTHEME.info
scripts[]= js/example.js
/* Example /sites/all/themes/YOURTHEME/js/example.js */
jQuery(document).ready(function($) {
$('nav ul.primary-menu').append('<div class="nav-blackhole"></div>');
});