2

I have a gallery of images that i have set up and when a user hovers over one I wan't it to show the title in a separate div. Ive tried the below code but to no avail. I'm not great at jquery so could someone please correct me?

Div's

galleryimages - Where the thumbnails (to be hovered) are kept

gallerydescription - Where the Title tag from the image is to be displayed.

I would like it also on mouse out that it would clear the description DIV.

<script type="text/javascript">
     $(document).ready(function(){
        $("img.galleryimages").hover(
           function () {
          ("#gallerydescription").html( $(this).attr("alt") );
           }, 
           function () {
              ("#gallerydescription").html("");
           }
        );
     });
</script>

Thanks

James Montagne
  • 77,516
  • 14
  • 110
  • 130
Dylan Benton
  • 109
  • 1
  • 11

1 Answers1

4
("#gallerydescription").html( $(this).attr("alt") );

should be:

$("#gallerydescription").html( $(this).attr("alt") );

Note the '$' at the beginning of the line.

George Cummins
  • 28,485
  • 8
  • 71
  • 90