tags:

views:

35

answers:

4

I am using this statement alert(el.parent().next());

But I am getting [object] [object] as an alert. How do I display the ID of the element?

+1  A: 

Have you tried?

alert(el.parent().next().attr("id"));
The MYYN
yes I did try that and it display empty alert
Gokul
Maybe the id is empty or el.parent().next() doesn't match anything
mck89
A: 

You must get its id attribute:

alert(el.parent().next().attr("id"));
mck89
A: 
alert(el.parent().next().attr("id"));

equivalent to

alert(el.parent().next()[0].id);
jAndy
A: 
el.parent().next().attr("id")
Bala R