jQuery getting class

Posted by andrei on Stack Overflow See other posts from Stack Overflow or by andrei
Published on 2010-06-11T07:49:51Z Indexed on 2010/06/11 7:52 UTC
Read the original article Hit count: 241

Filed under:
            $(document).ready(function(){

      $('img').click(function(){
 var class = $("img").attr("class");
 console.log(class);
      });

            });

Back with another question. I have 3 images each with a different class (image1, image2, image3). If i run the code above the log will only show the class of the first image no matter what image I click on

© Stack Overflow or respective owner

Related posts about jQuery