jquery nodename returning undefined

Posted by matthewsteiner on Stack Overflow See other posts from Stack Overflow or by matthewsteiner
Published on 2010-05-05T02:11:11Z Indexed on 2010/05/05 2:18 UTC
Read the original article Hit count: 368

Filed under:
|

This code isn't for anything in particular. I'm just trying to successfully get the tagName or nodeName of an element. However, when I run the following code, I always get an alert saying "undefined". I'm wondering if it's because this function executes when the document is ready? Is there a different place I should be doing this? Or is it probably my other javascript code conflicting somehow (I would doubt).

 $(document).ready(function(){
        $('#first').hover(function() {
            alert($('#last').nodeName);
        });
    });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about nodename