The jQuery itself is fine. Just a couple of things to watch out for:

1. You can only execute most jQuery code after the DOM has fully loaded. Almost all of your code should go in:

Code:
$(document).ready(function() {
   // code here
});
2. If you're using any other Javascript libraries, they may have taken control of the $ keyword. If that's the case, use jQuery instead of $ (i.e. jQuery(document).ready(function() { )