Wrap the click function in the document ready function, or place your code at the bottom of the page.
# main element does not exist when script is executed.
Example:
<script src="http://code.jquery.com/jquery-1.4.4.js"></script> <script> $(document).ready(function() { $('#main').click(function() { document.location.href='02.html'; }); }); </script>
Tjirp source share