tags:

views:

77

answers:

1

I created a new HTML element using jQuery.

var v=jQuery('<p>Hello</p>);

But when I try to get the nodeName of the new element,

v.nodeName.toLowerCase();

I get error, saying that nodeName is not defined. What is wrong here?

Thanks.

+2  A: 

v is the jQuery object that contains the dom element not the real dom element, you must do:

v[0].nodeName.toLowerCase();
mck89
Ohh.. i didn't know that.. Thanks ....
robert