Need Help with onClick opening Dialog box

Need Help with onClick opening Dialog box

Hi Guys,

Very new to this and am stuck already with an onClick command and it's puzzling me.  

What's meant to happen:
User clicks on the Shopping Cart text (within a div element which has been styled) and it opens a dialog box containing the users cart contents.

Here's the code below...

I think I've done a tad to much this week as I'm probably missing something really easy and am just being stupid.

Any help would be much appreciated.

  1. <script type="text/javascript">
  2. $(function() {
  3.     $( 'div.dialog' ).dialog( {modal:true,autoOpen:false} );
  4.     $('CartLink').on( 'click', function() {
  5.         var index = $(this).index() + 1;
  6.         $( '#dialog' +  index ).dialog( 'open' );
  7.     });
  8. });</script>
  9.         <div class="dialog" id="dialog1">Shopping Cart Contents</div>
  10. <div id="CartLink" class="fluid ShoppingCart"><img src="images/Site/Shopping_cart.gif" alt="" width="25" height="23"/>Shopping Cart</div>