jQuery .parent() does not work
Posted
by Misha Moroshko
on Stack Overflow
See other posts from Stack Overflow
or by Misha Moroshko
Published on 2010-05-28T07:10:18Z
Indexed on
2010/05/28
7:11 UTC
Read the original article
Hit count: 205
Why the following code fails with:
Error: class_a_jquery_objects[0].parent is not a function
?
HTML:
<div>
<div class='a b'></div>
<div class='b c'></div>
<div class='c a'></div>
</div>
<div id='log'></div>
JS:
$(function() {
var class_a_jquery_objects = $(".a");
$("#log").append(class_a_jquery_objects.length + "<br />");
$("#log").append(class_a_jquery_objects[0] + "<br />");
$("#log").append(class_a_jquery_objects[0].parent() + "<br />");
});
© Stack Overflow or respective owner