Bwyss
Bwyss

Reputation: 1834

Get the div id and the class

I have a snippet of code that is able to retrieve the div, but I am also after the class

 $(document).ready(function() {
            document.onmouseover = function(e) {
                var divID = e.target.id;
            }
        });

This works great, but I also need to get the div class, I was hoping to do something like var divClass = e.target.class but no dice.

Upvotes: 2

Views: 97

Answers (1)

Mathew Thompson
Mathew Thompson

Reputation: 56429

Try using the following:

e.target.className

Upvotes: 11

Related Questions